Ubuntu MySQL: Difference between revisions
From charlesreid1
(Created page with "=Admin= The stock Ubuntu version of MySQL is running on port 3306. The binary is <code>/usr/bin/mysql</code>. The configuration is in <code>/etc/mysql/my.cnf</code>. The data...") |
No edit summary |
||
| Line 55: | Line 55: | ||
sudo service mysql start | sudo service mysql start | ||
</pre> | </pre> | ||
[[Category:Ubuntu]] | |||
Latest revision as of 00:17, 16 March 2015
Admin
The stock Ubuntu version of MySQL is running on port 3306.
The binary is /usr/bin/mysql.
The configuration is in /etc/mysql/my.cnf.
The database data itself is stored in /var/lib/mysql.
Resetting Password
More info here: https://help.ubuntu.com/community/MysqlPasswordReset
To reset the admin password, first stop the mysql service:
sudo service mysql stop
Next, start mysql with the skip-grant-tables option so that it doesn't worry about authenticating users:
sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &
Now start mysql as the root user:
mysql -u root
Now execute the following commands in MySQL, one line at a time:
FLUSH PRIVILEGES;
SET PASSWORD FOR root@'localhost' = PASSWORD('password');
(alt? UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='root'; - in case you have root account that can connect from anywhere)
FLUSH PRIVILEGES;
Now you can type "exit" and get back to a regular command line.
Stop and start the MySQL service:
sudo service mysql stop # <-- not really necessary sudo service mysql start