Created
August 22, 2018 15:13
-
-
Save aristidesneto/c8dec1617639293174b985f64a772d44 to your computer and use it in GitHub Desktop.
Alterar senha de root do MariaDB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Após instalar o MariaDB você consiga entrar no banco de dados sem senha ou mesmo digitando qualquer senha ele entra, faça os passos a seguir para resolver esse problema. | |
1 - Conectar no banco: | |
sudo mysql -u root | |
2 - Consultar usuário cadastrados na tabela user | |
SELECT user, host FROM mysql.user; | |
+------------------+-----------+ | |
| User | Host | | |
+------------------+-----------+ | |
| root | localhost | | |
3 - Delete o usuário root@localhost | |
mysql> DROP USER 'root'@'localhost'; | |
Query OK, 0 rows affected (0,00 sec) | |
4 - Crie um novo usuário | |
mysql> CREATE USER 'root'@'%' IDENTIFIED BY ''; | |
Query OK, 0 rows affected (0,00 sec) | |
5 - Dê permissão para o usuário e carrega os privilégios | |
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; | |
Query OK, 0 rows affected (0,00 sec) | |
mysql> FLUSH PRIVILEGES; | |
Query OK, 0 rows affected (0,01 sec) | |
6 - Sai do banco e tente entrar novamente sem digitar sudo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment