">删除# service httpd24 restart问题来了,到浏览器输入192.168.1.9
其它的就不显示了。
查看日志
# less error_log[wed apr 08 08:58:56.795374 2015] [:error] [pid 4309] [client 192.168.1.9:58773] php warning: mysql_connect(): can't connect to mysql server on 'www.crwolf.com' (111) in /web/htdocs/index.php on line 15
[wed apr 08 08:58:56.795409 2015] [:error] [pid 4309] [client 192.168.1.9:58773] php warning: mysql_select_db() expects parameter 2 to be resource, boolean given in /web/htdocs/index.php on line 17
[wed apr 08 08:58:56.795448 2015] [:error] [pid 4309] [client 192.168.1.9:58773] php warning: mysql_query(): can't connect to local mysql server through socket '/tmp/mysql.sock' (2) in /web/htdocs/index.php on line 21
[wed apr 08 08:58:56.795457 2015] [:error] [pid 4309] [client 192.168.1.9:58773] php warning: mysql_query(): a link to the server could not be established in /web/htdocs/index.php on line 21
[wed apr 08 08:58:56.795475 2015] [:error] [pid 4309] [client 192.168.1.9:58773] php warning: mysql_query() expects parameter 2 to be resource, boolean given in /web/htdocs/index.php on line 22
[wed apr 08 08:58:56.795483 2015] [:error] [pid 4309] [client 192.168.1.9:58773] php warning: mysql_fetch_array() expects parameter 1 to be resource, null given in /web/htdocs/index.php on line 24
[wed apr 08 08:58:56.795490 2015] [:error] [pid 4309] [client 192.168.1.9:58773] php warning: mysql_close() expects parameter 1 to be resource, boolean given in /web/htdocs/index.php on line 38
好吧,数据库每打开
# service mysqld start #设置过开机启动,不知道为什么没有用再到浏览器刷新还是没有用
进入mysql
# mysql
mysql> use mysql
database changed
mysql> select host,user,password from user;
------------- ------------- -------------------------------------------
| host | user | password |
------------- ------------- -------------------------------------------
| localhost | root | *df216f57f1f2066124e1aa5491d995c3cb57e4c2 |
| 127.0.0.1 | root | |
| ::1 | root | |
| localhost | | |
------------- ------------- ------------------------------------------- 怎么会没有root用户,www.crwolf.com主机,第一次就创建了,可能不小心给删了,好吧,再重新创建
mysql> create user 'root'@'www.crwolf.com' identified by 'welcome';
error 1396 (hy000): operation create user failed for 'root'@'www.crwolf.com'你妹,这又是怎么回事,网上找了好久,说是bug了,解决方法:把要创建的用户删除一次,再创建,别忘记flush
mysql> drop user 'root'@'www.crwolf.com'; #都没有这个,还要再删除,挺郁闷的
query ok, 0 rows affected (0.00 sec)
mysql> flush privileges;
query ok, 0 rows affected (0.00 sec)
mysql> create user 'root'@'www.crwolf.com' identified by 'welcome';
query ok, 0 rows affected (0.00 sec)
mysql> flush privileges;
query ok, 0 rows affected (0.00 sec)
mysql> select host,user,password from user;
---------------- ------------- -------------------------------------------
| host | user | password |
---------------- ------------- -------------------------------------------
| localhost | root | *df216f57f1f2066124e1aa5491d995c3cb57e4c2 |
| 127.0.0.1 | root | |
| www.crwolf.com | root | *df216f57f1f2066124e1aa5491d995c3cb57e4c2 |
| ::1 | root | |
| localhost | | |
---------------- ------------- ------------------------------------------- 这次有用户了吧,再刷新页面,怎么还是刚刚的页面,再看日志
# less error_log[wed apr 08 10:14:37.502684 2015] [:error] [pid 5510] [client 192.168.1.9:60334] php warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /web/htdocs/index.php on line 24
[wed apr 08 10:18:46.821670 2015] [:error] [pid 5512] [client 192.168.1.9:60351] php warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /web/htdocs/index.php on line 24
登陆数据库的用户没有数据库的权限(这个只是我的,可能还有别的原因),到mysql授权。不解处:root还没有权限?
mysql> use mysql
database changed
mysql> grant select on table1.test to root ;
query ok, 0 rows affected (0.00 sec)再去刷新页面,终于好了。
转载于:https://blog.51cto.com/523958392/1629939
总结
以上是凯发ag旗舰厅登录网址下载为你收集整理的第二次启用httpd24调用mysql时出现的错误的全部内容,希望文章能够帮你解决所遇到的问题。
如果觉得凯发ag旗舰厅登录网址下载网站内容还不错,欢迎将凯发ag旗舰厅登录网址下载推荐给好友。