i have installed moodle and easyphp but database connection failed error is displayed.help me.

i have installed moodle and easyphp but database connection failed error is displayed.help me.

by Hardik Nadiyana -
Number of replies: 4
please answer me.
Average of ratings: -
In reply to Hardik Nadiyana

Re: i have installed moodle and easyphp but database connection failed error is displayed.help me.

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers
You'll need to provide a lot more detail for your problem before you can get any help.

mike
In reply to Mike Churchward

Re: i have installed moodle and easyphp but database connection failed error is displayed.help me.

by Esas Hadise -

i also have installed easyphp and i tried to write a simple php file:

add.html

     <form action='add.php' method='post'>
     <table>
       <tr>
         <td>NAME </td>
         <td><input type='text' name='membername' size='15'></td>
       </tr>
      
       <tr>
        <td>OCCUPATION</td>
        <td>
           <select name="occupation">
             <option value="cook">Cook</option>
             <option value="fireman">Fireman</option>
             <option value="manager">Manager</option>
           </select>
        </td>
       </tr>
      
       <tr>
         <td>Gender</td>
         <td><input type='radio' name='gender' value='male'> Male
             <input type='radio' name='gender' value='female'> Female
          </td>
         
       </tr>
     </table>
    
     <input type='submit' value='ADD'><br>
     <a href='main.html'>Back</a>
    </form>

add.php

   <?
      $user = "root";
      $pass = "de";

      $connect = mysql_connect("localhost", $user, $pass ) or die ("Error: Connectio to DB");
      mysql_select_db( "test" );


      // Create the table if it does not exist!!

      $query = "create table member
                ( m_id int not null auto_increment primary key,
                  m_name varchar(20) not null,
                  m_occupation  varchar(20) not null,
                  m_gender varchar(10) not null )" ;

      mysql_query ( $query );


      $query = "insert into member ( m_id, m_name, m_occupation, m_gender)
                values ( null, '$membername', '$occupation', '$gender')";

      $result = mysql_query ( $query );

      if ( !$result )
      {
        print ("Error : insert data to table");
      }
      else
      {
      $id = mysql_insert_id();

      print ("Member is registered with the id number <b>$id</b>");
      }
    ?>

but i get an error message;

Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: YES) in c:\program files\easyphp1-8\www\ex11\add.php on line 15
Error: Connectio to DB

can you help me?

In reply to Esas Hadise

Re: i have installed moodle and easyphp but database connection failed error is displayed.help me.

by Vu Hung -

You should check once again your username and password. Make sure that it's correct.

You can use command line to test the connection:

>>mysql -u root -p databasename

>>Enter password: password

Cheers,

Vu Hung

In reply to Vu Hung

Re: i have installed moodle and easyphp but database connection failed error is displayed.help me.

by gebari hadagi -

I have the same error it's saying

We could not connect to the database you specified. Please check your database settings.