Buenas
Como nota para que no me se olvide, publico aqui algunas medidas que se deberían hacer siempre al instalar MySQl.
- Cambiar la Pass de root:
Durante la instalación de MySQL ya se nos pide que la cambiemos, pero si no lo hemos hecho, o queremos volver a cambiársela, es el momento.
-Si conocemos cual era la clave anterior:$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is NN
Server version: X.Y.ZZ
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
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('NueVa PaSSWoRD') WHERE user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql>
$ sudo /etc/init.d/mysql restart
* Stopping MySQL database server mysqld [ OK ]
* Starting MySQL database server mysqld [ OK ]
* Checking for corrupt, not cleanly closed and upgrade needing tables.
$
-Si no conocemos cual era la clave anterior:$ sudo /etc/init.d/mysql stop
* Stopping MySQL database server mysqld [ OK ]
$ sudo mysqld_safe --skip-grant-tables
nohup: a ignorar a entrada e reencamiñado stderr para stdout
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[NNNNN]: started
Y desde otra consola, los mismo pasos que antes, pero conectando a MySQL sin password$ mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is NN
Server version: X.Y.ZZ
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
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('NueVa PaSSWoRD') WHERE user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
$ sudo /etc/init.d/mysql stop
* Stopping MySQL database server mysqld [ OK ]
$
Con lo que en la primera consola, donde iniciamos el mysqld_safe nos saldrá lo siguiente. A continuación, iniciamos de nuevo el MySQL y listo.STOPPING server from pid file /var/run/mysqld/mysqld.pid
mysqld_safe[NNNNN]: ended
$ sudo /etc/init.d/mysql start
* Starting MySQL database server mysqld [ OK ]
* Checking for corrupt, not cleanly closed and upgrade needing tables.
$ - Cambiar el nombre de root:
$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is NN
Server version: X.Y.ZZ
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
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 user="NueVO uSeR" where user="root";
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
$ sudo /etc/init.d/mysql restart
* Stopping MySQL database server mysqld [ OK ]
* Starting MySQL database server mysqld [ OK ]
* Checking for corrupt, not cleanly closed and upgrade needing tables.
$







