User Tools

Site Tools


wiki:mysql
no way to compare when less than two revisions

Differences

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


wiki:mysql [2012/11/12 19:17] (current) – created - external edit 127.0.0.1
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.
 +
 +<code bash>
 +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
 +</code>
 +
 +
 +===== 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]].
 +
 +<code bash>
 +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
 +</code>
  
wiki/mysql.txt · Last modified: 2012/11/12 19:17 by 127.0.0.1