Herramientas de usuario

Herramientas del sitio


wiki2:mysql

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Ambos lados, revisión anterior Revisión previa
Próxima revisión
Revisión previa
wiki2:mysql [2017/01/12 18:48]
alfred [Instalar la versión 5.6]
wiki2:mysql [2021/10/19 09:32] (actual)
Línea 1: Línea 1:
 ====== MySQL ====== ====== MySQL ======
-===== Allow remote connections ​=====+===== Create users =====
  
 +GRANT [type of permission] ON [database name].[table name] TO ‘[username]’@'​localhost’;​
 +
 +<​code>​
 +mysql> CREATE USER '​finley'​@'​localhost'​ IDENTIFIED BY '​some_pass';​
 +mysql> GRANT ALL PRIVILEGES ON *.* TO '​finley'​@'​localhost'​ WITH GRANT OPTION;
 +</​code>​
 +Allow remote connections:​
 <​code>​ <​code>​
-mysql> CREATE USER 'monty'​@'​localhost'​ IDENTIFIED BY '​some_pass';​ +mysql> CREATE USER 'finley'​@'​%'​ IDENTIFIED BY '​some_pass';​ 
-mysql> GRANT ALL PRIVILEGES ON *.* TO '​monty'​@'​localhost'​ +mysql> GRANT ALL PRIVILEGES ON *.* TO 'finley'​@'​%'​ WITH GRANT OPTION;
-    ->     WITH GRANT OPTION; +
-mysql> CREATE USER 'monty'​@'​%'​ IDENTIFIED BY '​some_pass';​ +
-mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'​@'​%'​ +
-    ->     WITH GRANT OPTION+
-mysql> CREATE USER '​admin'​@'​localhost';​ +
-mysql> GRANT RELOAD,​PROCESS ON *.* TO '​admin'​@'​localhost';​ +
-mysql> CREATE USER '​dummy'​@'​localhost'​;+
 </​code>​ </​code>​
  
 +For example, lets create an access for the user '​mantis'​ with password '​mantis'​ only available to connect from 81.4.127.208 to the database mantis:
 +<​code>​
 +create user '​mantis'​@'​81.4.127.208'​ identified by '​mantis';​
 +grant all privileges on mantis.* to '​mantis'​@'​81.4.127.208'​ with grant option;
 +flush privileges;
 +</​code>​
 +
 +<​code>​
 +FLUSH PRIVILEGES;
 +</​code>​
 +
 +<​code>​
 +DROP USER ‘demo’@‘localhost’;​
 +</​code>​
 ===== Entrar por consola con user y password ===== ===== Entrar por consola con user y password =====
 +-h <​host>​
 +<​code>​
 + mysql -u root -h 127.0.0.1 -p
 +</​code>​
 <​code>​ <​code>​
 mysql -u root -ppassword mysql -u root -ppassword
 </​code>​ </​code>​
  
 +===== Ejecutar commando =====
  
 +<​code>​
 +mysql -u root -h 127.0.0.1 -ppassword -e "​select * from users"
 +</​code>​
 ===== Backups ===== ===== Backups =====
 <​code>​ <​code>​
Línea 32: Línea 54:
 <​code>​ <​code>​
 mysql database_name < database_name.sql mysql database_name < database_name.sql
 +</​code>​
 +**Create a database and load an sql file on it:**
 +<​code>​
 +mysqladmin -u username -p"​password"​ create newDbName
 +mysql -u username -p"​password"​ newDbName < oldDbName.sql
 </​code>​ </​code>​
 <​code>​ <​code>​
 mysql --one-database database_name < all_databases.sql mysql --one-database database_name < all_databases.sql
 </​code>​ </​code>​
wiki2/mysql.1484246900.txt.gz · Última modificación: 2020/05/09 09:24 (editor externo)