User Tools

Site Tools



MySQL is a widely spread SQL database management system.

Reset the root password

If you have forgotten your MySQL Database password you can reset it the following way.

sudo -i
stop mysql
mysqld --skip-grant-tables &
mysql -u root mysql
UPDATE user SET Password=PASSWORD('PW') WHERE User='root';
killall mysqld
start mysql

Create a database with a database user

In order to be able to use a database, you need to create: a new database, and a user with access to that database. This section will explain how to create a new database and give a user the appropriate grant permissions. For the purpose of this tutorial, I will explain how to create a database and user for the OwnCloud web application.

mysql -u root mysql -p
create database owncloud;
grant usage on owncloud.* to owncloud@localhost identified by 'owncloudpasswd';
grant all privileges on owncloud.* to owncloud@localhost;
mysql -u owncloud -p'owncloudpasswd' owncloud
wiki/mysql.txt · Last modified: 2012/11/12 19:17 by