大家好:
今天分享一则当生产机上的网站php代码不能连接Mysql服务器时怎么办?
当LNMP的网站建立好后,我们需要测试网站中的php代码。但发现如下报错怎么办?
解决方法如下:
mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| jcquiz |
| mysql |
| performance_schema |
| wc |
+——————–+
5 rows in set (0.00 sec)
mysql>
mysql> grant all privileges on wc.* on 'wc'@'10.0.0.4' identified by 'wc';
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 'on 'wc'@'10.0.0.4' identified by 'wc'' at line 1
mysql> create user wc@localhost identified by 'wc';
Query OK, 0 rows affected (0.01 sec)
mysql> grant all privileges on wc.* to wc@10.0.0.4 identified by 'wc';
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql>
之后解决。
原创文章,作者:N24_Franklinhong,如若转载,请注明出处:http://www.178linux.com/64097
评论列表(1条)
能简单描述遇到上述问题是什么原因会更好~~~继续加油~