Versión: Server version: 10.1.32-MariaDB
Tengo problemas para establecer una contraseña en mysql o mariadb
uso xampp 5.6
Instalo xampp entro en la consola y con mysql -u root
me logueo bien.
Siguiendo diferentes ejemplos que he visto por distintas páginas web he probado diferentes formas de cambiar la clave, cada vez he desinstalado he instalado de nuevo el xampp.
Prueba 1:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('clave');
Prueba 2:
# mysqladmin -u root -p password clave
Enter password:
PC-CASA@DESKTOP-11KK10F c:\xampp
# mysql -u root -pclave
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.1.32-MariaDB mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use mysql
Database changed
MariaDB [mysql]>
Probando cualquiera de las dos formas si accedo desde la consola o el workbench accede perfectamente, si reinicio el mysql también accede perfectamente.
El problema viene cuando cargo un *.sql
con 2 bases de datos, la carga se hace correctamente veo las tablas y todo, pero cuando reinicio el mysql al intentar acceder de nuevo me arroja el error:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Prueba
MariaDB [(none)]> ALTER USER 'root'@'localhost' IDENTIFIED BY 'clave';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USER 'root'@'localhost' IDENTIFIED BY 'clave'' at line 1
MariaDB [(none)]>