The second time you enable HTTPD24 to invoke MySQL error

Source: Internet
Author: User

Tag:mysql   httpd24    called error    

# vim /etc/httpd24/httpd.confpidfile  "/var/run/httpd/httpd.pid" LoadModule php5_module         modules/libphp5.soDocumentRoot  "/web/htdocs" <directory   "/web/htdocs" ># vim /web/htdocs/index.php        # Inside the content is excerpt of <meta http-equiv= "Content-type"  content= "text/html; charset=utf-8" ><p> test </p><table border= "1"   width= "80%"  cellpadding= "0" ><tr>              <td width= "10%"  align= "center" >Id</td>             <td  Width= "20%"  align= "center" >Name</td>              <td width= "10%"  align= "center" >Age</td>          &nbsP;   <td width= "10%"  align= "center" >Sex</td>              <td width= "30%"  align= "center" >Address </td>             <td width= "20 % " align=" center >DoWith</td></tr><?php              //Connecting the database             / /Open a connection, connect to the local MySQL database              $conn =mysql_ Connect ("Www.crwolf.com", "root", "welcome");//ip,user,pwd             //Select a database of operations                      mysql_select_db ("table1", $conn);//  repository name, connection              $sql = "Select * from test";            //using mysql_query function to query from the database              mysql_query ("Set names utf-8");//handling Chinese garbled problem, GBK can be other values               $result =mysql_query ($sql, $conn);// search  sql, connection             //Loop Reading Records              while ($row =mysql_fetch_array ($result)) {?>             <tr>                     <td width= "10%"  align= " Center "><?php echo  $row [" ID "] ?></td>                     <td width= "20%"  align= "center" ><?php  echo  $row ["NAME"] ?></td>                     <td width= "10%"  align= "Center" > <?php echo  $row ["Age"] ?></td>                     <td width= "10%"  align= " Center "><?= $row [" SEX "]?></td>                     <td width= "30%"  align= "center" ><?=$ row["Address"]?></td>                     <td width= "20%"  align= "center" ><a href= "#"  mce_href= "#" &NBSP;&NBsp;                      onclick= "<?php    dodel ($row [" ID "])  ?>" > Delete </a> </td>                 </tr># service httpd24 restart

The problem comes to the browser input 192.168.1.9

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/5D/D0/wKiom1Ukk4HidVISAABeXYiB14s026.jpg "title=" 20.png "alt=" Wkiom1ukk4hidvisaabexyib14s026.jpg "/> Others are not shown.

View Logs

# 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 being 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 being 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 being 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 BES 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 being resource, boolean given in/web/htdocs/index.php on line 38


Okay, every open database.

# service Mysqld start #设置过开机启动, don't know why it's not used

Again to the browser refresh or no use

Go to MySQL

# mysqlmysql> use mysql database changedmysql> select host,user, password from user;+-------------+-------------+-------------------------------------------+|  host        | user         | password                                    |+-------------+-------------+-------------------------------------------+| localhost    | root        | * df216f57f1f2066124e1aa5491d995c3cb57e4c2 | |  127.0.0.1   | root        |                                              | |  ::1         | root         |                                             | |  localhost   |              |                                             |+-------------+-------------+-------------------------------- -----------+

How can there be no root user, www.crwolf.com host, the first time created, May accidentally deleted, OK, and then re-create

mysql> create user ' root ' @ ' www.crwolf.com ' identified by ' welcome '; ERROR 1396 (HY000): Operation CREATE USER failed for ' root ' @ ' www.crwolf.com '

Your sister, this is what is going on, online looking for a long time, said is a bug, the solution: to create a user delete once, and then create, don't forget to flush

mysql> drop user  ' root ' @ ' www.crwolf.com ';     #都没有这个, but also to delete, very depressed 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      |              |                                             |+----------------+-------------+----------- --------------------------------+

This time there are users, and then refresh the page, how or just the page, and then look at the log

# 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 being 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 being resource, boolean given in/web/htdocs/index.php on line 24


The user logging in to the database does not have permission to the database (this is just my, there may be other reasons), to MySQL authorization. Puzzled: Root does not have permission?

mysql> use MySQL Database changedmysql> grant Select on Table1.test to root; Query OK, 0 rows Affected (0.00 sec)

Again to refresh the page, finally good.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/5D/CC/wKioL1Ukmo-BiE9rAADbkVwpUrg773.jpg "title=" 21.png "alt=" Wkiol1ukmo-bie9raadbkvwpurg773.jpg "/>

This article is from the "three elder brother" blog, please be sure to keep this source http://523958392.blog.51cto.com/9871195/1629939

The second time you enable HTTPD24 to invoke MySQL error

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.