-
Notifications
You must be signed in to change notification settings - Fork 7
Installation: sql db for Fedora
We recommend using mysql, so that's what the instructions reflect.
- Install mysql-server
Ubuntu:sudo apt-get install mysql-server
CentOS:sudo yum install mysql-server
- Note the version of mysql-server you installed - it's listed in the download/install output
- Secure mysql-server and set a root password.
Ubuntu: the installer will prompt you to set a root password.
CentOS: start mysql withsudo service mysqld start
, then run/usr/bin/mysql_secure_installation
and follow the prompts to set the password and secure the db - (CentOS only) Set mysql to run automatically on startup/reboot
sudo chkconfig mysqld on
- Move mysql, configure data directory
sudo service mysqld stop
sudo cp -a /var/lib/mysql/ /opt/
sudo mkdir /etc/mysql
sudo mv /etc/my.cnf /etc/mysql/
- Edit /etc/mysql/my.cnf and change the data directory line to read:
datadir=/opt/mysql
- Configure mysql for fedora
-
set storage to InnoDB
sudo mkdir /etc/mysql/conf.d
Copy and paste the following block into your terminal window and hit enter
-
cat << EOF | sudo tee /etc/mysql/conf.d/innodb_engine.cnf
[mysqld]
default-storage-engine = InnoDB
EOF
```
1. Set character set to utf8
These variables are for mysql v 5.4 or lower – for >=5.5, use [mysqld] character-set-server
, for >= 5.6 use `[client] character_set_client`
Copy and paste the following block into your terminal window and hit enter
```bash
cat << EOF | sudo tee /etc/mysql/conf.d/utf8_charset.cnf
[mysqld]
default-character-set=utf8
[client]
default-character-set=utf8
EOF
```
- Confirm permissions for mysql directory and contents:
sudo chown -R mysql:mysql /opt/mysql
- Restart mysql
sudo service mysqld start
CentOS NOTE: if you have trouble restarting mysqld, please confirm that SELinux is disabled. - Create the mysql databases for fedora. Log in to mysql:
mysql -u root -p
Enter mysql root pw, which you set when you configured mysql-server. These instructions are shown with the mysql prompt and the expected output. To copy the commands into your shell, copy everything AFTER the > up to the semicolon; the expected output is shown in italics.
mysql>CREATE DATABASE hydradam_test;
Query OK, 1 row affected (0.00 sec)
mysql>
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON hydradam_test.* TO hdTests@localhost IDENTIFIED BY 'hdTests';
Query OK, 0 rows affected (0.00 sec)
mysql> CREATE DATABASE fedora3;
Query OK, 1 row affected (0.00 sec)
mysql> GRANT ALL ON fedora3.* TO fedoraDBAdmin@localhost IDENTIFIED BY 'fedoraAdmin';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL ON fedora3.* TO fedoraDBAdmin@'%' IDENTIFIED BY 'fedoraAdmin';
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye