MySQL password reset

  • Thu 13 November 2014
  • misc

The SmartOS standard64 14.2.1 image contains a lot of handy stuff pre-installed but not enabled. One odd thing that comes enabled by default is MySQL. Most of the time in my world I just want to kill that with svcadm disable mysql and keep on trucking, but on rare occasion I want to actually use it for something. Unfortunately, Joyent didn't document the default password, so you have to jump through a few hoops to change it manually. Here's how:

{% raw %} svcadm disable mysql mysqld_safe --skip-grant-tables & mysql -u root use mysql; update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root'; flush privileges; quit; mysqladmin -u root -p shutdown svcadm enable mysql

Have fun and enjoy MyFirstSQL (the DUPLO of Databases)!