MySQL: Difference between revisions
Add info about switching between pluggable auth |
→Create a DB and user: Add reference about auth plugins |
||
| Line 27: | Line 27: | ||
<source lang="sql"> | <source lang="sql"> | ||
CREATE DATABASE mediawiki; | CREATE DATABASE mediawiki; | ||
GRANT ALL PRIVILEGES ON mediawiki.* TO 'example_user'@'localhost' IDENTIFIED BY ' | GRANT ALL PRIVILEGES ON mediawiki.* TO 'example_user'@'localhost' IDENTIFIED BY 'secretpass'; | ||
</source> | </source> | ||
Note: Since the introduction of [https://mariadb.com/kb/en/library/development-pluggable-authentication/ Pluggable Authentication] in MySQL 5.7 and also MariaDB since 5.2, there is | == Set Password for Root user == | ||
The following command issues a new password for the root user while at the same time dictating which authentication plugin <ref>https://mariadb.com/kb/en/library/authentication-plugin-pam/</ref> to use. | |||
<source lang="sql"> | |||
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'secretpass'; | |||
</source> | |||
Note: Since the introduction of [https://mariadb.com/kb/en/library/development-pluggable-authentication/ Pluggable Authentication] in MySQL 5.7 and also MariaDB since 5.2, there is a "[https://mariadb.com/kb/en/library/authentication-plugin-unix-socket/ unix_socket]" plugin which authenticates the current user by their login to the OS, and thus NOT a password. If you have trouble setting the password, it's probably because you need to also specify the '''mysql_native_password''' auth at the same time <ref>https://www.percona.com/blog/2016/03/16/change-user-password-in-mysql-5-7-with-plugin-auth_socket/</ref> | |||
== What's going on? == | == What's going on? == | ||