Centos 7源码编译安装MySQL5.5及配置

原创
2017/10/27 16:14
阅读数 254
  1. 安装环境
  • yum -y install ncurses-devel openssl-devel
  • yum -y install tcp_wrappers-devel bison-devel bison
  • yum -y install gcc-c++
  • yum -y install cmake
  1. 添加mysql用户与组
  • groupadd mysql
  • useradd -g mysql -s /sbin/nologin -M mysql
  1. mysql源码编译
  • cd mysql_dir
  • rm ./cmake/CMakeCache.txt
  • cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql55/ -DMYSQL_DATADIR=/usr/local/mysql55/data -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_TCP_PORT=3306 -DMYSQL_UNIX_ADDR=/usr/local/mysql55/data/mysql.sock -DMYSQL_USER=mysql -DWITH_DEBUG=0
  • make
  • make install
  1. 安装数据库
  • cd /usr/local/mysql
  • chown -R mysql .
  • chgrp -R mysql .
  • scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql55 --- - datadir=/usr/local/mysql55/data
  • chown -R root .
  • chown -R mysql ./data
  • cp support-files/my-medium.cnf /etc/my.cnf
  1. 启动数据库
  • bin/mysqld_safe --user=mysql &
  • ps -ef|grep mysql
  1. 配置数据库
  • 修改数据库密码

bin/mysqladmin -u root password 'root'

bin/mysqladmin -u root -h localhost.localdomain password 'root'

  • 开机自启动

cp support-files/mysql.server /etc/init.d/mysqld

chmod +x /etc/init.d/mysqld

chkconfig -add mysqld

  • 安装服务

cp support-files/mysql.server /etc/init.d/mysql.server

service mysql.server start

service mysql.server stop

service mysql.server restart

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部