Generally if the password for MySql is not set during the installation, then these commands will help you set it externally.
It is also useful when it shows error -
"ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO"
/etc/init.d/mysqld stop
mysqld_safe --skip-grant-tables &
mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD("newrootpassword") where User='root';
mysql> flush privileges;
mysql> quit
/etc/init.d/mysqld stop
/etc/init.d/mysqld start
It is also useful when it shows error -
"ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO"
/etc/init.d/mysqld stop
mysqld_safe --skip-grant-tables &
mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD("newrootpassword") where User='root';
mysql> flush privileges;
mysql> quit
/etc/init.d/mysqld stop
/etc/init.d/mysqld start
No comments:
Post a Comment