Setting MySQL root password for the first time

Reminder, on Linux set password for the first time:

mysqladmin -u root password THEPASSWORD

Or, when there is a known password:

mysqladmin -u root -p password THEPASSWORD

Or, when using tables (first install or when password is known):

# mysql -u root -pBLABLA
mysql> use mysql
mysql> update user set password=PASSWORD("NEWBLA") where user = 'root';
mysql> flush privileges;
mysql> quit

One thought on “Setting MySQL root password for the first time

  1. /etc/init.d/mysql stop
    cd /usr/bin
    ./mysqld_safe –user=mysql –skip-grant-tables –skip-networking &
    ./mysqladmin -u root flush-privileges password “newpassword”
    /etc/init.d/mysql restart

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.