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.cnf
uncommenting themax_connections
line and set the value to100000
(max_connections = 100000
). Additionally, you should add the parameterskip-log-bin
to themysqld.cnf
to prevent excessive logging. - Restart MySQL service
systemctl restart mysql
to 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';
wheremynewuser
is your dbadmin andgoodPassword
is 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
cluster
database:- Connect with the new user: type
quit
to 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.