January 2018
Intermediate to advanced
446 pages
12h 57m
English
On Unix-like systems, you stop the server and start it by specifying init-file. You can save the ALTER USER 'root'@'localhost' IDENTIFIED BY 'New$trongPass1' SQL code in that file. MySQL executes the contents of the file at startup, changing the password of the root user:
shell> sudo systemctl stop mysqldshell> pgrep mysqld
shell> vi /var/lib/mysql/mysql-init-passwordALTER USER 'root'@'localhost' IDENTIFIED BY 'New$trongPass1';shell> sudo chmod 400 /var/lib/mysql/mysql-init-passwordshell> sudo chown mysql:mysql /var/lib/mysql/mysql-init-password
Read now
Unlock full access