Friday 11 January 2013

Solution of Database Connection error in mysql in WAMP server

I am trying all solution but I am able to connect to mysql Database in WAMP Server.

Every time it display DATABASE NOT CONNECTED.

In this blog i am giving you the solution of most common problem arises while using MySql in WAMP Server.

Question : I have created my webConfig  but  I am not able to connect to my Mysql database ?
Answer: 

1 step    : Go to C:\wamp\www\testmysql.php and try

<?php
                 $link = mysql_connect("localhost:3306","root",""); or use 8080
                 if (!$link) {
      die('Could not connect to MySQL: ' . mysql_error());
                             }
                 echo 'Connection OK';
 mysql_close($link);
    ?>

2 step     :  Go to your webconfig file in your Website folder

      

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'collegetpoint');   ..........your database name

/** MySQL database username */
define('DB_USER', 'root');               .............database user

/** MySQL database password */
define('DB_PASSWORD', '');        ................not need

/** MySQL hostname */
define('DB_HOST', 'localhost:3306');..............as per above

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');


3 step:

After all  this changes run the Server and test for Database again.