2015-04-26 12:48:37 +05:30
# Database MySQL
2014-09-02 18:07:02 +05:30
## Note
We do not recommend using MySQL due to various issues. For example, case [(in)sensitivity ](https://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html ) and [problems ](http://bugs.mysql.com/bug.php?id=65830 ) that [suggested ](http://bugs.mysql.com/bug.php?id=50909 ) [fixes ](http://bugs.mysql.com/bug.php?id=65830 ) [have ](http://bugs.mysql.com/bug.php?id=63164 ).
## MySQL
# Install the database packages
sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev
# Ensure you have MySQL version 5.5.14 or later
mysql --version
2015-04-26 12:48:37 +05:30
# Pick a MySQL root password (can be anything), type it and press enter
# Retype the MySQL root password and press enter
2014-09-02 18:07:02 +05:30
2015-04-26 12:48:37 +05:30
# Secure your installation
2014-09-02 18:07:02 +05:30
sudo mysql_secure_installation
# Login to MySQL
mysql -u root -p
2015-04-26 12:48:37 +05:30
# Type the MySQL root password
2014-09-02 18:07:02 +05:30
# Create a user for GitLab
# do not type the 'mysql>', this is part of the prompt
# change $password in the command below to a real password you pick
mysql> CREATE USER 'git'@'localhost' IDENTIFIED BY '$password';
2015-04-26 12:48:37 +05:30
# Ensure you can use the InnoDB engine which is necessary to support long indexes
2014-09-02 18:07:02 +05:30
# If this fails, check your MySQL config files (e.g. `/etc/mysql/*.cnf` , `/etc/mysql/conf.d/*` ) for the setting "innodb = off"
mysql> SET storage_engine=INNODB;
# Create the GitLab production database
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci` ;
2015-04-26 12:48:37 +05:30
# Grant the GitLab user necessary permissions on the database
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES ON `gitlabhq_production` .* TO 'git'@'localhost';
2014-09-02 18:07:02 +05:30
# Quit the database session
mysql> \q
# Try connecting to the new database with the new user
sudo -u git -H mysql -u git -p -D gitlabhq_production
# Type the password you replaced $password with earlier
# You should now see a 'mysql>' prompt
# Quit the database session
mysql> \q
# You are done installing the database and can go back to the rest of the installation.