User Tools

Site Tools


wiki:mysql

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

wiki:mysql [2012/11/12 19:17] (current)
Line 1: Line 1:
 +====== MySQL ======
 +
 +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';​
 +FLUSH PRIVILEGES;
 +exit;
 +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 [[http://​www.owncloud.org|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;​
 +exit;
 +mysql -u owncloud -p'owncloudpasswd' owncloud
 +