mysql-5.5使用

1. cd /server/script/

2. tar zxvf cmake-3.9.0.tar.gz

cd cmake-3.9.0

./configure

gmake

gmake intall

3. groupadd mysql

4. useradd mysql -s /sbin/nologin -M -g mysql

5. tar zxvf ncurses-5.9.tar.gz

cd ncurses-5.9

./configure --with-shared --without-debug --without-ada --enable-overwrite

make

make install clean

6. tar zxvf mysql-5.5.57.tar.gz

cd mysql-5.5.57

mkdir /application

cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.57 -DMYSQL_DATADIR=/application/mysql-5.5.57/data -DMYSQL_UNIX_ADDR=/application/mysql-5.5.57/tmp/mysql.sock -DDEFAULT_CHARSET=gbk -DDEFAULT_COLLATION=gbk_chinese_ci -DENABLED_LOCAL_INFILE=ON -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 -DWITHOUT_PARTITION_STORAGE_ENGINE=1

make -j 4 && make install

7. ln -s /application/mysql-5.5.57/ /application/mysql

8. ll support-files/my*.cnf

9. cp support-files/my-small.cnf /etc/my.cnf

10. chown -R mysql.mysql /application/mysql/*

11. chmod -R 777 /tmp/

12. rm -fr /application/mysql/data/* 当初始化错误,删除内容重新初始化

13. /application/mysql/scripts/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data/ --user=mysql

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

15. chmod 700 /etc/init.d/mysqld

16. 启动报错:cat /application/mysql-5.5.57/data/sever.err

17. echo 'export PATH=$PATH:/application/mysql/bin'>>/etc/profile

18. source /etc/profile

19. mysql

20. 简单优化:show databases;

drop database test;

select user,host from mysql.user;

delete from mysql.user;

select user,host from mysql.user;

grant all privileges on *.* to system@'localhost' identified by '211570xcy' with grant option; 添加用户  不能登录授权

flush privileges;

select user.host from mysql.user;

show grants for system@'localhost';

mysql -usystem -p'211570xcy'

原文地址:https://www.cnblogs.com/guoxiaobao/p/14775625.html