mysql5.7

1、mv mysql-5.7.22-linux-glibc2.12-x86_64 mysql

2、 chown -R work:work /home/work/mysql

3、su - work

4、mkdir etc data logs tmp

5、 vim etc/my.cnf

6、 /home/work/mysql/bin/mysqld --defaults-file=/home/work/mysql/etc/my.cnf --basedir=/home/work/mysql --datadir=/home/work/mysql/data --user=root --initialize

7、查看数据库密码 grep password /home/work/mysql/data/error.log

8、启动数据库 /home/work/mysql/bin/mysqld_safe --defaults-file=/home/work/mysql/etc/my.cnf & 

8.1 已启动数据库登陆命令 /home/work/mysql/bin/mysql --no-defaults -uroot -S /home/work/mysql/mysql.sock 

9、修改数据库密码 use mysql;alter user 'root'@'localhost' identified by '123456'; 或者 use mysql;UPDATE user SET authentication_string = password('123456'),password_expired = 'N',password_last_changed = now() WHERE User = 'root';

 生效密码 FLUSH PRIVILEGES;

10、关闭数据库  /home/work/mysql/bin/mysqladmin -u root -p123456 -S /home/work/mysql/tmp/mysql.sock shutdown

11、登陆数据库 /home/work/mysql/bin/mysql  -u root -p

posted @ 2019-04-30 10:47  tengfei520  阅读(133)  评论(0编辑  收藏  举报