mysql版本:mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz
参考安装过程:点击打开链接 点击打开链接
遇到问题:我的解压安装之后并没有/usr/local/mysql/support-files/my-default.cnf
没有这个文件就意味着后面用户名密码不好设置
如何免密码登陆:
# /etc/init.d/mysqld stop
# ./mysqld_safe --user=root --skip-grant-tables --skip-networking
# mysql -uroot
mysql> UPDATE mysql.user SET Password(密码字段自己看,我的是 authentication_string)=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
登陆:
#mysql -uroot -pnewpassword
这并不是最终密码(因为有时候会出错)
(这里和参考的解决方法不一样,我的是先用newpassword当作密码登陆进去然后再做需改)
进去后不管输入什么都报错ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
解决:set password=password('输入你的密码');