Resetting the root password for Blastwave's MySQL 5 on Solaris 10
Recently I needed to reset the root password for Blastwave's MySQL 5 package.
Normally I would just follow these instructions, however in this install I needed to make sure that Blastwave's svc manifest started and stopped the database for me. Here are the steps I too, executed as the system's root user:
1. Stop the MySQL server:
# svcadm disable network/cswmysql5
2. Edit the Bastwave svc manifest
# vi /opt/csw/lib/svc/method/svc-cswmysql5
by adding the following line, save and exit:
MYSQLD_SKIP_GRANT_TABLES=true
3. start up the MySQL server again
# svcadm enable network/cswmysql5
4. connect to the server
# /opt/csw/mysql5/bin/mysql -u root mysql
5. set the new root password
mysql> UPDATE user SET password=PASSWORD('new password') WHERE user='root';
mysql> \q
6. Disable the MySQL server again
# svcadm disable network/cswmysql5
7. Once again, edit the Bastwave svc manifest
# vi /opt/csw/lib/svc/method/svc-cswmysql5
and remove/comment out the line we just added in step 2:
MYSQLD_SKIP_GRANT_TABLES=true
8. Fire up the MySQL server, once more
# svcadm enable network/cswmysql5
9. and finally try connecting to the server, using your new root password
# /opt/csw/mysql5/bin/mysql -u root mysql -p
Normally I would just follow these instructions, however in this install I needed to make sure that Blastwave's svc manifest started and stopped the database for me. Here are the steps I too, executed as the system's root user:
1. Stop the MySQL server:
# svcadm disable network/cswmysql5
2. Edit the Bastwave svc manifest
# vi /opt/csw/lib/svc/method/svc-cswmysql5
by adding the following line, save and exit:
MYSQLD_SKIP_GRANT_TABLES=true
3. start up the MySQL server again
# svcadm enable network/cswmysql5
4. connect to the server
# /opt/csw/mysql5/bin/mysql -u root mysql
5. set the new root password
mysql> UPDATE user SET password=PASSWORD('new password') WHERE user='root';
mysql> \q
6. Disable the MySQL server again
# svcadm disable network/cswmysql5
7. Once again, edit the Bastwave svc manifest
# vi /opt/csw/lib/svc/method/svc-cswmysql5
and remove/comment out the line we just added in step 2:
MYSQLD_SKIP_GRANT_TABLES=true
8. Fire up the MySQL server, once more
# svcadm enable network/cswmysql5
9. and finally try connecting to the server, using your new root password
# /opt/csw/mysql5/bin/mysql -u root mysql -p