Results 1 to 3 of 3

Thread: mysql database missing

  1. #1
    Join Date
    Nov 2012
    Beans
    29

    mysql database missing

    Dear All

    I just installed MySQL Server 5.5 under Ubuntu 12.10 through repository. When I was trying to change the password, I got following message:

    Code:
    ll@wenwen:~$ mysqladmin -u root password "newpassword";
    mysqladmin: connect to server at 'localhost' failed
    error: 'Access denied for user 'root'@'localhost' (using password: NO)'
    ll@wenwen:~$
    I googled online; it seems the reason I could not change password is because the "mysql" database is lost. So I checked the installed database and got following information:

    Code:
    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | test               |
    +--------------------+
    2 rows in set (0.00 sec)
    
    mysql>
    So is the "mysql" database missing? How can I recover it?

  2. #2
    Join Date
    Dec 2012
    Location
    Canada
    Beans
    187
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: mysql database missing

    Before you ran the `show databases;` command you must have connected to MySQL. If you did that using the command

    Code:
    mysql
    then you connected to MySQL as the "null" user (no username and no password). In that case the 'mysql' database will not show up because the null user does not have permission to see it.

    When installing 'mysql-server' from the repositories you will be prompted to set the MySQL root password. If you repeatedly decline (and it will ask you about three (3) times) then the MySQL root user will have no password. This is not recommended for security reasons. However, if you do that then you can connect to MySQL as root via

    Code:
    mysql --user=root
    If that command gives you the same error you received before ('Access denied for user 'root'@'localhost' (using password: NO)') then your MySQL server does have a root password. If you don't know what that password is then you can reset the MySQL root password using the instructions here (from the MySQL Reference Manual).

  3. #3
    Join Date
    Nov 2012
    Beans
    29

    Re: mysql database missing

    Wow! Thank you so much! What you said is EXACTLY what I felt confused about! Now I understand (I think) the difference between different connection mode.

    I followed your suggestion; and then tried to connect to mysql using following command:
    Code:
    mysql -u root -p
    It did ask for password (thankfully I still I remember it); after I supplied password, I got connected. Then I issued show databases command, and the 'mysql' showed this time:

    Code:
    mysql> show databases
        -> ;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | performance_schema |
    | test               |
    +--------------------+
    4 rows in set (0.03 sec)
    
    mysql>
    Again, thank you very much!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •