1、安装cmake (可能需要安装 yum install gcc-c++)
2、安装yum install ncurses-devel -y
3.创建用户和组 groupadd mysql
useradd mysql -s /sbin/nologin -M -g mysql
4、tar xf mysql-5.5.32.tar.gz
5、进入MySQL目录,(可能需要 yum install bison)执行
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=ON -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 -DWITHOUT_PARTITION_STORAGE_ENGINE=1 -DWITH_FAST_MUTEXES=1 -DWITH_ZLIB=bundled -DENABLED_LOCAL_INFILE=1 -DWITH_READLINE=1 -DWITH_EMBEDDED_SERVER=1 -DWITH_DEBUG=0 -DMYSQL_TCP_PORT=3306
6、make && make install
7、cp mysql-5.5.32/support-files/my-small.cnf /etc/my.cnf
8、添加环境变量 export PATH=/usr/local/mysql/bin:$PATH
9、授权 chown -R mysql.mysql /usr/local/mysql/data/
10、chmod -R 1777 /tmp/
11、在MySQL的安装目录下的scripts文件夹下,执行./mysql_install_db --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ --user=mysql
12、负责MySQL启动命令 cp support-files/mysql.server /etc/init.d/mysqld
13、授权chmod +x /etc/init.d/mysqld
14、启动MySQL /etc/init.d/mysqld start
15、查看运行的进程 netstat -lntup|grep 3306
16、删除无用的用户和host,select user,host from mysql.user ;
删除test数据库
17、删除root用户,添加别的数据库管理员
delete from mysql.user;
grant all privileges on *.* to system@'localhost' identified by 'yjw' with grant option;
/usr/local/mysql//bin/mysqladmin -u root password 'new-password' --设置密码
/usr/local/mysql//bin/mysqladmin -u root -h bogon password 'root' --修改密码