The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Connecting to Database

Discussion in 'General Discussion' started by sbrad, Aug 14, 2001.

  1. sbrad

    sbrad Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    113
    Likes Received:
    0
    Trophy Points:
    16
    A little help would be very much appreciated.
    We\'ve changed the mySql root password. It was previously NULL. Well, it seems that Cpanel is connecting to the database as root, because I get the following error on the main user screen where it lists the number of databases, and also on the database screen:
    [quote:15f3704c4a]ERROR 1045: Access denied for user: \'root@localhost\' (Using password: YES) [/quote:15f3704c4a]
    Can someone tell me where to go to change the password so it will connect?
    I was able to find the config.inc.php file for phpMyAdmin, and successfully changed it, but I can\'t find this anywhere.
     
  2. teck

    teck Well-Known Member

    Joined:
    Aug 10, 2001
    Messages:
    164
    Likes Received:
    0
    Trophy Points:
    16
    Make sure the right info is in /root/.my.cnf
     
  3. sbrad

    sbrad Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    113
    Likes Received:
    0
    Trophy Points:
    16
    [quote:31b76d236b]Make sure the right info is in /root/.my.cnf
    [/quote:31b76d236b]
    <edit>Well, I thought that fixed it, but it didn't.

    [Edited on 8/14/01 by sbrad]
     
  4. Site5-Matt

    Site5-Matt Well-Known Member
    PartnerNOC

    Joined:
    Aug 10, 2001
    Messages:
    81
    Likes Received:
    0
    Trophy Points:
    6
    If you forgot your mysql root pass, you can reset it with this script:
    [code:1:7c47f09e4e]
    #!/usr/bin/perl

    print "Enter new root pass: ";
    chomp($newroot = <STDIN>);
    chomp($hostname = `hostname`);

    system("kill `cat /var/lib/mysql/$hostname.pid`");
    sleep(2);
    system("killall -9 mysqld");
    system("safe_mysqld --skip-grant-tables &");
    sleep(2);
    system("mysql -h localhost -e \"update user set Password=PASSWORD('$newroot') where User='root'\" mysql");
    system("mysqladmin -h localhost flush-privileges");
    print "mysql root pass set to $newroot\n";

    if (! -e "/root/.my.cnf") {
    open(MY, ">/root/.my.cnf") || die "can't open my.cnf for writing: $!\n";
    print MY "[client]\npassword=$newroot\n";
    close MY;
    system("chmod 640 /root/.my.cnf");
    }
    print "Be sure to edit /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.php.inc!\n";
    exit;
    [/code:1:7c47f09e4e]
    Hope that helps!

    Regards,
    Matt

    [Edited on 8/14/01 by Site5-Matt]
     
  5. sbrad

    sbrad Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    113
    Likes Received:
    0
    Trophy Points:
    16
    Also...I tried changing the root password back to nothing, but it doesn\'t work. I\'m doing it through WHM, and it says it changes it, but it doesn\'t.
     
  6. sbrad

    sbrad Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    113
    Likes Received:
    0
    Trophy Points:
    16
    Hi Matt. Thanks for the script.
    Unfortunately, this is what I get when I run it:
    [quote:4fd264be25]Bareword found where operator expected at reset.cgi line 12, near \"\"mysql -h localhost -e \"update\"
    (Missing operator before update?)
    syntax error at reset.cgi line 12, near \"\"mysql -h localhost -e \"update user \"
    String found where operator expected at reset.cgi line 12, near \"\'root\'\" mysql\"\"
    (Missing operator before \" mysql\"?)
    Execution of reset.cgi aborted due to compilation errors. [/quote:4fd264be25]
     
  7. bdraco

    bdraco Guest

    /usr/local/cpanel/bin/updatephpmyadmin

    You are probably looking to run this script.
     
  8. moronhead

    moronhead Well-Known Member

    Joined:
    Aug 12, 2001
    Messages:
    706
    Likes Received:
    0
    Trophy Points:
    16
    [quote:8f970e772c].... I\'m doing it through WHM, and it says it changes it, but it doesn\'t. [/quote:8f970e772c]

    WHM doesn\'t seem to update the new MySql password in ~/.my.cnf. Try putting the password in manually in that file after you\'ve changed it in WHM.

    Nick, I know this isn\'t the bugs section, but you may like to have a look at this :)

    Regards.
     
  9. bdraco

    bdraco Guest

    [quote:a5e6cfe454][quote:a5e6cfe454].... I\'m doing it through WHM, and it says it changes it, but it doesn\'t. [/quote:a5e6cfe454]

    WHM doesn\'t seem to update the new MySql password in ~/.my.cnf. Try putting the password in manually in that file after you\'ve changed it in WHM.

    Nick, I know this isn\'t the bugs section, but you may like to have a look at this :)

    Regards. [/quote:a5e6cfe454]


    Please post it in bugs so I can hope to keep track :)
     
  10. moronhead

    moronhead Well-Known Member

    Joined:
    Aug 12, 2001
    Messages:
    706
    Likes Received:
    0
    Trophy Points:
    16
    [quote:44910f6c72] Please post it in bugs so I can hope to keep track.[/quote:44910f6c72]
    Done.
     
  11. sbrad

    sbrad Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    113
    Likes Received:
    0
    Trophy Points:
    16
    Ok, here\'s what I did to fix it.
    Deleted the password in /root/.my.cnf and deleted it from config.inc.php in /usr/local/cpanel/base/3rdparty/phpMyAdmin

    Then I ran /usr/local/cpanel/bin/updatephpmyadmin and all of the problems disappeared. :D
    Thanks for all the help. Now I don\'t have 200 people screaming at me anymore.
     
  12. viisage

    viisage Member

    Joined:
    Aug 30, 2002
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    My Sql

    I looked in config.inc.php in /usr/local/cpanel/base/3rdparty/phpMyAdmin

    But I dont see a password set. I did delete it from the other suggestion and after I updated my php, it changed password set to no in Cpanel, what else do I need to do?
     
Loading...

Share This Page