Ir para conteúdo
Fórum Script Brasil
  • 0

(resolvido) ERROR 1045 - Mysql


Grall Fernandes

Pergunta

Colegas

Estou com problemas no Mysql, ao digitar vi console:

#mysql -u root

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

mysql -u root -p senha

Enter password:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Estava conectando com o primeiro parametro:

#mysql -u root

Pois estou trabalhando o zabbix, estava acessando via browser, mas as senha não funcionava.

Login e senha invalida, tanto a padrão, admin

Como posso restaurar o banco mysql sem utilizar senha

Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

  • 0

Oi, 'Grall Fernandes' !

Siga os passos abaixo para restaurar a senha do root.

1 - Pare o servidor MySQL

# /etc/init.d/mysql stop
Stopping MySQL database server: mysqld.
2 - Re-Inicie o MySQL sem senha
# mysqld_safe --skip-grant-tables &
[1] 4131Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[4193]: started
3 - Reconecte-se ao MySQL sem senha
$ mysql client - mysql -u root 
Welcome to the MySQL monitor. Commands end with; or \g.
Your MySQL connection id is 1 to server version: xxxxxxx

Type 'help;' or '\h' for help. Type '\c' to clear the buffer. 

mysql>
4 - Atribua uma nova senha a root
mysql> use mysql;
Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A

Database changed 

mysql> update user set password=PASSWORD("nova_senha_do_root") where User='root';

Query OK, 2 rows affected (0.00 sec)
Rows matched: 2 Changed: 2 Warnings: 0
5 - atribua os privilégios à nova senha do root e encerre a sessão do mysql
mysql> flush privileges; 

Query OK, 0 rows affected (0.00 sec) 

mysql> quit Bye
6 - Pare novamente o Servidor MySQL (ver item 1) e reinicie o servidor MySQL como abaixo:
# /etc/init.d/mysql start 

Starting MySQL database server: mysqld.
7 - Teste a nova conexão
$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with; or \g.
Your MySQL connection id is 6 to server version: xxxxxx

Type 'help;' or '\h' for help. Type '\c' to clear the buffer. 

mysql>

Pronto.

Link para o comentário
Compartilhar em outros sites

  • 0
Oi, 'Grall Fernandes' !

Siga os passos abaixo para restaurar a senha do root.

1 - Pare o servidor MySQL

# /etc/init.d/mysql stop
Stopping MySQL database server: mysqld.
2 - Re-Inicie o MySQL sem senha
# mysqld_safe --skip-grant-tables &
[1] 4131Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[4193]: started
3 - Reconecte-se ao MySQL sem senha
$ mysql client - mysql -u root 
Welcome to the MySQL monitor. Commands end with; or \g.
Your MySQL connection id is 1 to server version: xxxxxxx

Type 'help;' or '\h' for help. Type '\c' to clear the buffer. 

mysql>
4 - Atribua uma nova senha a root
mysql> use mysql;
Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A

Database changed 

mysql> update user set password=PASSWORD("nova_senha_do_root") where User='root';

Query OK, 2 rows affected (0.00 sec)
Rows matched: 2 Changed: 2 Warnings: 0
5 - atribua os privilégios à nova senha do root e encerre a sessão do mysql
mysql> flush privileges; 

Query OK, 0 rows affected (0.00 sec) 

mysql> quit Bye
6 - Pare novamente o Servidor MySQL (ver item 1) e reinicie o servidor MySQL como abaixo:
# /etc/init.d/mysql start 

Starting MySQL database server: mysqld.
7 - Teste a nova conexão
$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with; or \g.
Your MySQL connection id is 6 to server version: xxxxxx

Type 'help;' or '\h' for help. Type '\c' to clear the buffer. 

mysql>

Pronto.

Valeu , Denis

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.


  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,8k
×
×
  • Criar Novo...