Find the answer to your Linux question:
Results 1 to 6 of 6
Hi, I finish doing installation for MySQL 5.1 using rpm. So now, i want to login to mysql database but i dont know the password. Can anyone tell me how ...
  1. #1
    Just Joined!
    Join Date
    Jan 2007
    Posts
    6

    Question How to: MySQL

    Hi,

    I finish doing installation for MySQL 5.1 using rpm. So now, i want to login to mysql database but i dont know the password. Can anyone tell me how to reset the password? The default installation for MySQL is 4.1. Where the exact place or directory for MySQL 5.1? My server install with CentOS 4.1.

    Thank you.

  2. #2
    Linux Engineer b2bwild's Avatar
    Join Date
    Jul 2008
    Location
    Behind You!
    Posts
    1,108
    If you havent setup a root password before.
    use this
    # mysqladmin -u root password NEWPASSWORD
    or this if you want to change or update password
    # mysqladmin -u root -p oldpassword newpass
    then login
    # mysql -u root -p
    Never make any misteaks.

    Read my Blog at --> Penguin Inside Subscribe Feed

  3. #3
    Linux Newbie
    Join Date
    Feb 2009
    Posts
    99
    kill all MySQL Server side process.
    ps aux | grep mysql
    use command "kill -9 PID" or " service mysqld stop"

    then start mysql by hand "mysqld_safe --skip-granttable" <-- I am not sure this option spell correct, you can use mysqld_safe --help try to confirm .


    when mysqld_safe --skip-granttable & <--- start you can use command "mysql" login to mysql db as administrator.

    update mysql.user set password=password('123') where user='root';
    flush privilege;

    your password change finish.

  4. #4
    Linux Guru waterhead's Avatar
    Join Date
    Jul 2004
    Location
    Franklin, Wisconsin
    Posts
    4,577
    I just installed MySQL on Fedora 10, and I couldn't access the server to set up the password. I finally had to use the "skip-grant-tables" option that signmem mentions. But instead of adding it as an option to the mysql command, I had to add it to the /etc/my.cnf file. It should look like this:
    Code:
    [mysqld]
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    user=mysql
    # Default to using old password format for compatibility with mysql 3.x
    # clients (those using the mysqlclient10 compatibility package).
    old_passwords=1
    skip-grant-tables
    I was then able to set up the password and start the server. I then removed it from the file.

    I found a very helpful online book for MySQL:
    MySQL Essentials - Techotopia
    Paul

    Please do not send Private Messages to me with requests for help. I will not reply.

  5. #5
    Linux Newbie
    Join Date
    Feb 2009
    Posts
    99
    never add

    old_passwords=1
    skip-grant-tables

    to my.cnf

    it means never load grant-tables <-- it use to define use's permission!!!

    after type flush privileges

    restart mysqld server.

  6. #6
    Linux Guru waterhead's Avatar
    Join Date
    Jul 2004
    Location
    Franklin, Wisconsin
    Posts
    4,577
    Quote Originally Posted by signmem View Post
    never add

    old_passwords=1
    skip-grant-tables

    to my.cnf

    it means never load grant-tables <-- it use to define use's permission!!!
    Quote Originally Posted by waterhead View Post
    I was then able to set up the password and start the server. I then removed it from the file.
    If I hadn't performed that little step of adding that to the my.cnf file, I wouldn't be able to use MySQL. So "never" doesn't apply to this problem. Yes, it must be removed after setting the root password for MySQL.
    Paul

    Please do not send Private Messages to me with requests for help. I will not reply.

Posting Permissions

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