如何解决生产机上php代码连接mysql报错的故障

大家好:

今天分享一则当生产机上的网站php代码不能连接Mysql服务器时怎么办?

当LNMP的网站建立好后,我们需要测试网站中的php代码。但发现如下报错怎么办?

blob.png

解决方法如下:

 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>

之后解决。

blob.png

原创文章,作者:N24_Franklinhong,如若转载,请注明出处:http://www.178linux.com/64097

(0)
N24_FranklinhongN24_Franklinhong
上一篇 2016-12-18 21:48
下一篇 2016-12-18 22:00

相关推荐

  • 马哥教育网络班21期+第10周课程练习

    1、请详细描述CentOS系统的启动流程(详细到每个过程系统做了哪些事情) POST –>Boot Sequence(BIOS) –> Boot Loader(MBR) –> Kernel(ramdisk) –>rootfs –>…

    Linux干货 2016-09-19
  • 性能调优概述

    大纲: 一、概述 二、什么是性能调优?(what) 三、为什么需要性能调优?(why) 四、什么时候需要性能调优?(when) 五、什么地方需要性能调优?(where) 六、什么人来进行性能调优?(who) 七、怎么样进行性能调优?(How) 八、总结 注,硬件配置:CUP Xeon E5620 x 2 8核心, 内存 16G , 硬盘 RAID 10,操作…

    Linux干货 2015-02-10
  • wk_04作业

    1、复制/etc/skel目录为/home/tuser1,要求/home/tuser1及其内部文件的属组和其它用户均没有任何访问权限。 # cp -r  /etc/skel/ /home/tuser1 # chmod 700 /home/tuser1 2、编辑/etc/group…

    Linux干货 2016-12-27
  • Linux命令总结

      1、登陆和开关机       关机    halt    poweroff    init 0    重启    reboot    init 6    shutdown    shutdown -r 重启    shutodwn -h 关机    shutdown -c 取消计划关机    shutdown +0 马上关机    +1 一分钟后关机  …

    2017-09-11
  • 编译安装nginx并实现反向代理负载均衡和缓存功能

    一、编译安装nginx 1、下载 [root@ns1 ~]# wget http://nginx.org/download/nginx-1.10.0.tar.gz 2、解压 [root@ns1 ~]# tar xf nginx-1.10.0.tar.gz [root@ns1 ~]…

    Linux干货 2016-05-25
  • YUM 的使用和YUM源的配置

    简介     yum(Yellow dog Updater Modified)是CentOS中属于RPM前端软件包管理器,能从指定的服务器中下载RPM包,并自动分析和处理RPM包之间的依赖关系,最后将依次所依赖的软件包都安装了,而无需繁琐的一个一个安装。 一 yum repository:yum仓库 yum仓库的组成部…

    Linux干货 2016-02-14

评论列表(1条)

  • 马哥教育
    马哥教育 2016-12-23 12:40

    能简单描述遇到上述问题是什么原因会更好~~~继续加油~