About mysql Change password set password for root @ localhost = password ( 'xxx'); given Solution

Once you have installed mysql, I found mysql -u root -ppress enter two times even without a password will be able to log in, but navicat mysql connection requires a password ah. How to do?
So I look for a long time by Baidu found that most are modified by the following command. However, the implementation Times following his own fault.

mysql> set password for root@localhost = password('123456');
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'passw
ord('123456')' at line 1

Later, I successfully changed the password by following commands.
SET PASSWORD FOR root@localhost = '123456';

mysql> SET PASSWORD FOR root@localhost = '123456';
Query OK, 0 rows affected (0.04 sec)

Successfully modified.

Guess you like

Origin www.cnblogs.com/jing-tian/p/12231780.html