mysql 相關

如果遠程連接Mysql时发生以下错误,可按照下文更改:

 ERROR 1130: Host '192.168.1.3' is not allowed to connect to this MySQLserver

[root@louts_test01 loutsx]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables
-> ;
+---------------------------+
| Tables_in_mysql |
+---------------------------+
| columns_priv |
| db |
| event |
| func |
| general_log |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| host |
| ndb_binlog_index |
| plugin |
| proc |
| procs_priv |
| servers |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+---------------------------+
23 rows in set (0.00 sec)

mysql> select host,user from user;
+---------------+------+
| host | user |
+---------------+------+
| 127.0.0.1 | root |
| localhost | |
| localhost | root |
| louts\_test01 | |
| louts\_test01 | root |
+---------------+------+
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> select host,user from user;
+---------------+------+
| host | user |
+---------------+------+
| % | root |
| 127.0.0.1 | root |
| localhost | |
| louts\_test01 | |
| louts\_test01 | root |
+---------------+------+
5 rows in set (0.00 sec)

mysql>
mysql>
mysql>
mysql>
mysql> flush;
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 '' at line 1
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

原文地址:https://www.cnblogs.com/syother/p/7906477.html