I’ve set up MySQL enough times figuring things out from docs that I decided I need to take notes.
This is a destructive re-install. Don’t do this if you value your data. In fact, just don’t do this.
Cleanup after old installs.
sudo systemctl stop mysqld.service sudo yum erase mysql mariadb-libs #remove files that have the vestiges of old installs sudo rm -rf /var/lib/mysql/ sudo rm -rf /etc/mysql/conf.d/ sudo rm -rf /etc/my.cnf.d/ sudo rm -rf /etc/my.cnf
#Install sudo yum install mysql-server # run the server sudo systemctl start mysqld.service #create a db sudo mysqladmin create keystone
Connect to the database as root to do the basics. Yes, this could be scripted from the command line:
To Create a user for ayoung
$ sudo mysql keystone Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 11 Server version: 5.5.39-MariaDB-wsrep MariaDB Server, wsrep_25.10.r4014 Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [keystone]> CREATE USER 'ayoung'@'localhost' IDENTIFIED BY 'password'; Query OK, 0 rows affected (0.00 sec) MariaDB [keystone]> GRANT ALL PRIVILEGES ON * . * TO 'ayoung'@'localhost'; Query OK, 0 rows affected (0.00 sec) MariaDB [keystone]>
Log in as ayoung
$ mysql keystone --password Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 14 Server version: 5.5.39-MariaDB-wsrep MariaDB Server, wsrep_25.10.r4014 Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [keystone]>