- 安装环境
- 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
- 添加mysql用户与组
- groupadd mysql
- useradd -g mysql -s /sbin/nologin -M mysql
- 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
- 安装数据库
- 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
- 启动数据库
- bin/mysqld_safe --user=mysql &
- ps -ef|grep mysql
- 配置数据库
- 修改数据库密码
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