Skip to content
Snippets Groups Projects
Select Git revision
  • ag-test
  • rs-test
  • master default protected
  • test-me-pa
  • mksionek-master-patch-52381
  • new-branch-10
  • test-conflicts
  • test-suggestions
  • alejandro-test
  • patch-25
  • winh-test-image-doscussion
  • stg-lfs-image-test-2
  • stg-lfs-image-test
  • test42016
  • issue_42016
  • issue-32709
  • add-codeowners
  • ClemMakesApps-master-patch-62759
  • bvl-staging-test
  • bvl-merge-base-api
  • v9.2.0-rc6 protected
  • v9.2.0-rc5 protected
  • v9.2.0-rc4 protected
  • v9.2.0-rc3 protected
  • v9.1.4 protected
  • v9.2.0-rc2 protected
  • v9.2.0-rc1 protected
  • v9.1.3 protected
  • v8.17.6 protected
  • v9.0.7 protected
  • v9.1.2 protected
  • v9.1.1 protected
  • v9.2.0.pre protected
  • v9.1.0 protected
  • v9.1.0-rc7 protected
  • v9.1.0-rc6 protected
  • v9.0.6 protected
  • v9.1.0-rc5 protected
  • v9.1.0-rc4 protected
  • v9.1.0-rc3 protected
40 results

databases.md

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    databases.md 1.49 KiB

    Setup Database

    GitLab supports the following databases:

    • MySQL (preferred)
    • PostgreSQL

    MySQL

    # Install the database packages
    sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev
    
    # Login to MySQL
    mysql -u root -p
    
    # Create a user for GitLab. (change $password to a real password)
    mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password';
    
    # Create the GitLab production database
    mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
    
    # Grant the GitLab user necessary permissopns on the table.
    mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
    
    # Quit the database session
    mysql> \q
    
    # Try connecting to the new database with the new user
    sudo -u git -H mysql -u gitlab -p -D gitlabhq_production

    PostgreSQL

    # Install the database packages
    sudo apt-get install -y postgresql-9.1 libpq-dev
    
    # Login to PostgreSQL
    sudo -u postgres psql -d template1
    
    # Create a user for GitLab. (change $password to a real password)
    template1=# CREATE USER git WITH PASSWORD '$password';
    
    # Create the GitLab production database & grant all privileges on database
    template1=# CREATE DATABASE gitlabhq_production OWNER git;
    
    # Quit the database session
    template1=# \q
    
    # Try connecting to the new database with the new user
    sudo -u git -H psql -d gitlabhq_production