Linux 安装mysql出现的问题

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zhang_guyuan/article/details/78094450

1、Linux安装mysql过程中没有提示设置密码,在第一次使用的时候,可以使用/etc/mysql/debian.cnf中的client的用户名和密码登录修改mysql密码

mysql> use mysql;

Database changed
mysql> update user set password=password('123456') where user='root';
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
mysql>
authentication_string字段
update user set authentication_string=password('1234') where user='root';
Query OK, 1 row affected, 1 warning (0.01 sec)

Rows matched: 1  Changed: 1  Warnings: 1


2、使用root登录mysql的过程提示错误代码1045,可以使用下面方面解决问题(亲自测试有效)

直接使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码:
# mysql -udebian-sys-maint -p
Enter password: <输入[client]节的密码>
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit

# mysql -uroot -p
Enter password: <输入新设的密码newpassword>


猜你喜欢

转载自blog.csdn.net/zhang_guyuan/article/details/78094450