Como instalar MySQL en Linux Ubuntu

Desde una pantalla de terminal ejecuta los siguientes comandos.

sudo apt update
sudo apt install mysql-server
sudo mysql_secure_installation

El comando anterior inicializa la seguridad de MySQL por lo que te hará una serie de preguntas como que nivel de seguridad debe tener la clave, que clave le pondrás al usuario, etc. Abajo te escribo en rojo mi sugerencia de respuestas a las preguntas.

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: Y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG:
 2

Please set the password for root here.


New password:

Re-enter new password:

Ya que seleccionamos el nivel 1 la clave que pongas debe ser compuesta por letras, números y caracteres especiales.

Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y

Por ultimo te hace una serie de preguntas como si quieres eliminar los accesos a usuarios anónimos, que se puedan conectar con el usuario root de forma remota, etc. a todo esto debes contestar Y.

  • Remove anonymous users? [Y/n]: Y
  • Disallow root login remotely? [Y/n]: Y
  • Remove test database and access to it? [Y/n]:  Y
  • Reload privilege tables now? [Y/n]:  Y

Con esto tienes instalado y asegurada tu base de datos, para ingresar desde la misma terminal basta con ejecutar el siguiente comando y te pedirá la clave que configuraste anteriormente.

mysql -u root -p

Deja un comentario