大家好:
今天分享一則當生產機上的網站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.www58058.com/64097
能簡單描述遇到上述問題是什么原因會更好~~~繼續加油~