Could not connect to MySQL server!

Discussion in 'Installation/Configuration' started by bruma, Aug 13, 2006.

  1. bruma

    bruma New Member

    Hi!

    I've changed mysql server passwd (in shell). Then I change/adopt passwd in /home/admispconfig/ispconfig/lib/config.inc.php. But now when I restart ispconfig, I get error:
    What is wrong? Is there another file that should be updated?
    I could normaliy login in mysql ($mysql -u root -p), my mysql passwd cointains just alphanumeric characters.
     
  2. sjau

    sjau Local Meanie Moderator HowtoForge Supporter

    When you change the mysql password you need to either flush the privileges or restart the mysql server... the same goes if you alter the privileges altogether :)
     
  3. bruma

    bruma New Member

    Yes, I did flush privileges and also restart mysql server.

    I'm using ISPConfig 2.2.6. Will reinstall fix that problem? I don't want to lose current configuration and data.
     
    Last edited: Aug 13, 2006
  4. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    Please check your MySQL password in config.inc.php for typos.
    Can you connect on the shell with
    Code:
    mysql -u root -p
    using the same password?
     
  5. bruma

    bruma New Member

    Yes, passwd is exactly the same, I also double check for typos in config.inc.php.
     
  6. sjau

    sjau Local Meanie Moderator HowtoForge Supporter

    can you test this script and tell me the output?

    Code:
    <?
    
    //Global variables:
    $username = ""; // Username for database here
    $password = ""; // Password for database here
    $db_host = "localhost"; // DB Server
    $db_name =  ""; //name of your database here
    
    // Connect to DB
    mysql_connect("$db_host","$username","$password")
    	or die("Unable to connect to SQL server!");
    mysql_select_db("$db_name")
    	or die("Unable to select database!");
    
    echo "Connection established to $db_name";
    
    ?>
    
     
  7. bruma

    bruma New Member

    This is the output:
    My server is Ubuntu 6.06. Installed mysql packages:
    ii mysql-client 5.0.22-0ubuntu6.06 mysql database client (current version)
    ii mysql-client-5.0 5.0.22-0ubuntu6.06 mysql database client binaries
    ii mysql-common 5.0.22-0ubuntu6.06 mysql database common files (e.g. /etc/mysql
    ii mysql-server 5.0.22-0ubuntu6.06 mysql database server (current version)
    ii mysql-server-5.0 5.0.22-0ubuntu6.06 mysql database server binaries
     
    Last edited: Aug 15, 2006
  8. sjau

    sjau Local Meanie Moderator HowtoForge Supporter

    Now this is interesting. Is php actually built with mysql?

    Code:
    <? phpinfo(); ?>
    
    You should get something like this:

     
  9. bruma

    bruma New Member

    from <? phpinfo(); ?>:

     
  10. sjau

    sjau Local Meanie Moderator HowtoForge Supporter

  11. bruma

    bruma New Member

    Thank you very much sjau, info on page http://www.whoopis.com/howtos/mysql-auth-fix.html
    did the trick.

    FYI, I execute in mysql shell:
    tnx, bruma
     
  12. sjau

    sjau Local Meanie Moderator HowtoForge Supporter

    It works but I still don't quite see why you actually had a problem first-hand. Maybe Falko can help there.
     
  13. bruma

    bruma New Member

    Here is whole scenario, what I did.
    My mysql root passwd was week so I decided to change it. When I change it first time, I use non-alphanumeric chars. At that moment I didn't know that I shouldn't use non-alphanumeric chars in mysql passwd. So I change it again to alphanumeric chars. After that I got error "Could not connect to MySQL server!".

    Before first passwd change I also upgraded apache2 (with apt-get upgrade).
     

Share This Page