1
set password for 'dog'@'host'=password('dog');
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 ‘password(‘dog’)’ at line1
在mysql之前的版本这样做应该是没有问题的,然而我用的是mysql8.0,这样写应该就不行了。
2 正确写法
mysql> ALTER USER 'pig'@'localhost' IDENTIFIED WITH mysql_native_password BY 'pig' ;
Query OK, 0 rows affected (0.02 sec)