gitlab-org--gitlab-foss/doc/install/database_mysql.md

46 lines
1.7 KiB
Markdown
Raw Normal View History

2014-02-20 04:10:25 -05:00
## 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).
2014-02-20 04:10:25 -05:00
## MySQL
2014-02-20 04:51:58 -05:00
# Install the database packages
sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev
2014-02-20 04:10:25 -05:00
2014-02-20 04:51:58 -05:00
# Pick a database root password (can be anything), type it and press enter
# Retype the database root password and press enter
2014-02-20 04:10:25 -05:00
2014-02-20 04:51:58 -05:00
# Secure your installation.
sudo mysql_secure_installation
2014-02-20 04:10:25 -05:00
2014-02-20 04:51:58 -05:00
# Login to MySQL
mysql -u root -p
2014-02-20 04:10:25 -05:00
2014-02-20 04:51:58 -05:00
# Type the database root password
2014-02-20 04:10:25 -05:00
2014-02-20 04:51:58 -05:00
# 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';
2014-02-20 04:10:25 -05:00
2014-02-20 04:51:58 -05:00
# Create the GitLab production database
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
2014-02-20 04:10:25 -05:00
2014-02-20 04:51:58 -05:00
# Grant the GitLab user necessary permissions on the table.
mysql> GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'git'@'localhost';
2014-02-20 04:10:25 -05:00
2014-02-20 04:51:58 -05:00
# Quit the database session
mysql> \q
2014-02-20 04:10:25 -05:00
2014-02-20 04:51:58 -05:00
# Try connecting to the new database with the new user
sudo -u git -H mysql -u git -p -D gitlabhq_production
2014-02-20 04:10:25 -05:00
2014-02-20 04:51:58 -05:00
# Type the password you replaced $password with earlier
2014-02-20 04:10:25 -05:00
2014-02-20 04:51:58 -05:00
# You should now see a 'mysql>' prompt
2014-02-20 04:10:25 -05:00
2014-02-20 04:51:58 -05:00
# Quit the database session
mysql> \q
2014-02-20 04:10:25 -05:00
2014-02-20 04:51:58 -05:00
# You are done installing the database and can go back to the rest of the installation.