Skip to content

Instantly share code, notes, and snippets.

@merolhack
Last active October 1, 2015 20:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save merolhack/0188cb404c6f61f4e775 to your computer and use it in GitHub Desktop.
Save merolhack/0188cb404c6f61f4e775 to your computer and use it in GitHub Desktop.
REHL(Centos & Oracle Linux): Instalación y configuración de MySQL
# Instalar MySQL de los repositorios de REMI
yum --enablerepo=remi install mysql mysql-server -y
# Iniciar servicio
service mysqld start
# Iniciar servicio al iniciar el sistema
chkconfig mysqld on
# Agregar regla a IPTables para el puerto 3306
iptables -I INPUT 5 -p tcp --dport 3306 -m state --state NEW,ESTABLISHED -j ACCEPT
# Guardar regla:
service iptables save
# Ejecutar script para configurar MySQL
/usr/bin/mysql_secure_installation
Set root password? [Y/n] Y
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] n
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
# Ingresar vía consola como usuario root:
mysql -h localhost -u root -p
# 1. Crear base de datos:
CREATE DATABASE NOMBRE_SCHEMA
DEFAULT CHARACTER SET utf8
DEFAULT COLLATE utf8_general_ci;
# 2. Crear usuario:
CREATE USER 'NOMBRE_USUARIO'@'%'
IDENTIFIED BY 'CONTRASEÑA';
# 3. Otorgar privilegios:
GRANT ALL PRIVILEGES ON NOMBRE_SCHEMA.*
TO 'NOMBRE_USUARIO'@'%';
# 4. Refrescar privilegios:
FLUSH PRIVILEGES;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment