Mysql-u root-p
Mysql>use MySQL;
Mysql>update User Set host = '% ' where user = ' root ';
Mysql>flush privileges;
mysql> use MySQL
Reading table information for completion of table and column names
Can turn off this feature to get a quicker startup with-a
Database changed
mysql> Update user Set Password=password (' root123 ') where user= ' root ' and host= ' localhost '
;
Query OK, 1 row Affected (0.00 sec)
Rows matched:1 changed:1 warnings:0
Mysql> Select ' Host ' from user where user= ' root '
;
+------+
| Host |
+------+
| Host |
| Host |
| Host |
| Host |
+------+
4 rows in Set (0.00 sec)
Mysql> GRANT All privileges on * * to ' root ' @ '% ' identified by ' root123 ' with GRANT OPTION;
Error 1064 (42000): You have a error in your SQL syntax; Check the manual-corresponds to your MySQL server version for the right syntax-use near '% ' identified by ' root123 ' With GRANT OPTION ' at line 1
Mysql> Grant all privileges on * * to ' root ' @ '% ' identified by ' root123 ' with GRANT option;
Query OK, 0 rows Affected (0.00 sec)
mysql> Update user set host= '% ' where user= ' root '
Flush privileges;
Error 1064 (42000): You have a error in your SQL syntax; Check the manual-corresponds to your MySQL server version for the right syntax-use-near ' flush-privileges ' at line 2
mysql> flush Privileges;
Query OK, 0 rows Affected (0.00 sec)
Mysql> Select host from user where user= ' root '
;
+-----------------------+
| Host |
+-----------------------+
| % |
| 127.0.0.1 |
| :: 1 |
| localhost |
| Localhost.localdomain |
+-----------------------+
5 rows in Set (0.00 sec)
mysql> Update user set host= '% ' where user= ' root ';
ERROR 1062 (23000): Duplicate entry '%-root ' for key ' PRIMARY '
mysql> flush Privileges;
Query OK, 0 rows Affected (0.00 sec)
Mysql> Select Host,user from user where user= ' root '
;
+-----------------------+------+
| Host | user |
+-----------------------+------+
| % | root |
| 127.0.0.1 | root |
| :: 1 | root |
| localhost | root |
| Localhost.localdomain | Root |
+-----------------------+------+
5 rows in Set (0.00 sec)
Mysql>
MySQL Remote connection Host * is not allowed to connect to this MySQL server