标签:show from 客户端 word 错误 mysql serve 认证 示例
由以下示例得出,客户端连接MySQL时执行语句包括如下过程:
1.认证
是否可以登录MySQL服务端。
2.语法分析
判断执行语句是否合法,无语句错误。
3.权限分析
判断执行语句,是否有对目标的相关权限。
4.语义分析
判断是否存在相应的表和字段
5.优化执行
优化器优化SQL语句后,执行并返回结果。
1)mysql -utest -h127.0.0.1 -p -P3306 -perror
Warning: Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user ‘test‘@‘127.0.0.1‘ (using password: YES)
mysql> show grants;
+--------------------------------------------------------------------------+
| Grants for test@127.0.0.1 |
+--------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO ‘test‘@‘127.0.0.1‘ IDENTIFIED BY PASSWORD <secret> |
| GRANT SELECT ON `test`.* TO ‘test‘@‘127.0.0.1‘ |
+--------------------------------------------------------------------------+
2 rows in set (0.00 sec)
mysql>
mysql>
2)
mysql> select *** from test.t;
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 ‘** from test.t‘ at line 1
mysql>
3)
mysql> select * from a.t;
ERROR 1142 (42000): SELECT command denied to user ‘test‘@‘127.0.0.1‘ for table ‘t‘
mysql>
mysql>
4)
mysql> select * from test.t;
ERROR 1146 (42S02): Table ‘test.t‘ doesn‘t exist
mysql>
mysql>
标签:show from 客户端 word 错误 mysql serve 认证 示例
原文地址:https://blog.51cto.com/liuzhanbin/2371579