1.update user set password=password(‘123456’) where User=‘root’;
mysql>
mysql> UPDATE user SET PASSWORD=PASSWORD('123456') WHERE User='root';
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 '('123456') WHERE User='root'' at line 1
mysql> user mysql;
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 'user mysql' at line 1
mysql> use mysql;
Database changed
mysql> UPDATE user SET PASSWORD=PASSWORD('123456') WHERE User='root';
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 '('123456') WHERE User='root'' at line 1
mysql> update user set password=password('123456') where User='root'
-> ;
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 '('123456') where User='root'' at line 1
mysql>
出现了语法错误之后,查看user表中字段。
2. 查看mysql user 表
mysql> desc user;
+--------------------------+-----------------------------------+------+-----+-----------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------------------+-----------------------------------+------+-----+-----------------------+-------+
| Host | char(255) | NO | PRI | | |
| User | char(32) | NO | PRI | | |
| Select_priv | enum('N','Y') | NO | | N | |
| Insert_priv | enum('N','Y') | NO | | N | |
| Update_priv | enum(