Configure mysqld service to start and stop using systemctld:
After installing MySQL initialize and start MySQL instance:
mysqld --defaults-file=/etc/instance_name.cnf --initialize-insecure &
mysqld --defaults-file=/etc/instance_name.cnf &
mysqladmin -uroot -S/mysql/instance_name/data/instance_name.sock shutdown
***** su to user root *****
edit file /usr/lib/systemd/system/mysqld.service and add following
[Service]
PIDFile=/mysql/instance_name/data/instance_name.pid
ExecStart=/usr/sbin/mysqld --defaults-file=/etc/instance_name.cnf --daemonize --pid-file=/mysql/instance_name/data/instance_name.pid $MYSQLD_OPTS
$sudo systemctl daemon-reload
$sudo systemctl start mysqld
$sudo systemctl enable mysqld
***** su to root *****
#reboot
***** su to user mysql *****
$mysql -uroot -S/mysql/instance_name/data/instance_name.sock
mysql> alter user 'root'@'localhost' identified by '<code>';mysql> create user 'dba'@'localhost' identified by '<code>';mysql> GRANT ALL PRIVILEGES ON *.* TO 'dba'@'%' IDENTIFIED BY '<code>' WITH GRANT OPTION;
After installing MySQL initialize and start MySQL instance:
mysqld --defaults-file=/etc/instance_name.cnf --initialize-insecure &
mysqld --defaults-file=/etc/instance_name.cnf &
mysqladmin -uroot -S/mysql/instance_name/data/instance_name.sock shutdown
***** su to user root *****
edit file /usr/lib/systemd/system/mysqld.service and add following
[Service]
PIDFile=/mysql/instance_name/data/instance_name.pid
ExecStart=/usr/sbin/mysqld --defaults-file=/etc/instance_name.cnf --daemonize --pid-file=/mysql/instance_name/data/instance_name.pid $MYSQLD_OPTS
$sudo systemctl daemon-reload
$sudo systemctl start mysqld
$sudo systemctl enable mysqld
***** su to root *****
#reboot
***** su to user mysql *****
$mysql -uroot -S/mysql/instance_name/data/instance_name.sock
mysql> alter user 'root'@'localhost' identified by '<code>';mysql> create user 'dba'@'localhost' identified by '<code>';mysql> GRANT ALL PRIVILEGES ON *.* TO 'dba'@'%' IDENTIFIED BY '<code>' WITH GRANT OPTION;
Comments
Post a Comment