Estos son los apuntes para dar de alta una base de datos y un usuario que tenga acceso a la misma.
servidor:usuario # mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.45 Source distribution
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql> create database MiBase;
Query OK, 1 row affected (0.00 sec)
Acceso desde cualquier host:
mysql> GRANT ALL PRIVILEGES ON MiBase.* TO UsuarioMiBase@»%» IDENTIFIED BY ‘ContraseñaUsuarioMiBase’ WITH GRANT OPTION;
Acceso desde el localhost:
mysql>GRANT ALL PRIVILEGES ON MiBase.* TO UsuaioMiBase@localhost IDENTIFIED BY ‘ContrseñaUsuarioMiBase’ WITH GRANT OPTION;
Para crear un superusuario que ingrese de cualquier host:
mysql> GRANT ALL PRIVILEGES ON *.* TO OtroSuperUsuario@»%» IDENTIFIED BY ‘ContraseñaOtroSuperUsuario’ WITH GRANT OPTION;
Acceso desde el localhost:
mysql>GRANT ALL PRIVILEGES ON *.* TO OtroSuperUsuario@localhost IDENTIFIED BY ‘ContraseñaOtroSuperUsuario’ WITH GRANT OPTION;
Finalmente aplicamos los nuevos permisos a nuestros usuarios con:
mysql>flush privileges;
Y listo.