Create MySQL Database
NOTE: If you are logged in as a non-root user, you will need to pre-pend the commands with
sudo.
- Install MySQL:
apt-get install mysql-server– during the MySQL installation, you may be prompted to set the root password – make a note of what you set this to. - IMPORTANT: Modify
/etc/mysql/mysql.conf.d/mysqld.cnfuncommenting themax_connectionsline and set the value to100000(max_connections = 100000). Additionally, you should add the parameterskip-log-binto themysqld.cnfto prevent excessive logging. - Restart MySQL service
systemctl restart mysqlto apply the above settings - Add non-root database user:
- Connect to database as root
mysql -u root -p(enter root password if you set one). - Create a new user: at
mysql>prompt:CREATE USER 'mynewuser'@'%' IDENTIFIED BY 'goodPassword';wheremynewuseris your dbadmin andgoodPasswordis your secure password. - If you are successful, you will see
Query OK, 0 rows affected (0.00 sec) - Apply privileges to the new user:
GRANT ALL PRIVILEGES ON * . * TO 'mynewuser'@'%'; - Reload the privileges to make sure the new ones are in place:
FLUSH PRIVILEGES;
- Connect to database as root
- Create
clusterdatabase:- Connect with the new user: type
quitto log out the root user, thenmysql -u mynewuser -p - Create database:
CREATE DATABASE cluster;
- Connect with the new user: type
The database will be populated by the stream manager when that is running.