Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
mysql [2017/09/22 17:40]
jdx
mysql [2019/06/02 11:12] (current)
Line 3: Line 3:
  
 ===== Mysql cli connect ===== ===== Mysql cli connect =====
-<sxh>+<code>
 mysql -p<​pass>​ -u<​user>​ -h <​host>​ -P <​port>​ <​db_name>​ mysql -p<​pass>​ -u<​user>​ -h <​host>​ -P <​port>​ <​db_name>​
 mysql -A -p<​pass>​ -u<​user>​ -h <​host>​ -P <​port>​ <​db_name>​ mysql -A -p<​pass>​ -u<​user>​ -h <​host>​ -P <​port>​ <​db_name>​
-</sxh>+</code>
  
  
 ===== Install tools in Debian ===== ===== Install tools in Debian =====
-<sxh>+<code>
 apt install default-mysql-client apt install default-mysql-client
-</sxh>+apt install mysql-workbench 
 +</code>
  
 ===== Kill a process ===== ===== Kill a process =====
-<sxh>+<code>
 show full processlist;​ show full processlist;​
 kill <​processId>;​ kill <​processId>;​
-</sxh>+</code>
  
 (also possible with MySQL Administrator -> Server Connections) (also possible with MySQL Administrator -> Server Connections)
  
 ===== Change user password ===== ===== Change user password =====
-<sxh>+<code>
 mysqladmin -u any_user -p'​newpwd'​ password '​oldpwd'​ mysqladmin -u any_user -p'​newpwd'​ password '​oldpwd'​
 mysqladmin -u root -p'​newpwd'​ password '​oldpwd'​ mysqladmin -u root -p'​newpwd'​ password '​oldpwd'​
-</sxh>+</code>
  
 ===== Create a backup table ===== ===== Create a backup table =====
-<sxh sql>+<code sql>
 CREATE TABLE results_bak LIKE results; CREATE TABLE results_bak LIKE results;
 INSERT results_bak SELECT * FROM results; INSERT results_bak SELECT * FROM results;
-</sxh>+</code>
  
 ===== Drop a table ===== ===== Drop a table =====
-<sxh sql>+<code sql>
 DROP TABLE IF EXISTS results_bak;​ DROP TABLE IF EXISTS results_bak;​
-</sxh>+</code>
  
 ===== Dumps ===== ===== Dumps =====
  
 ==== Dump an entire database ==== ==== Dump an entire database ====
-<sxh>+<code>
 mysqldump -p<​pass>​ -u<​user>​ -h <​host>​ -P <​port>​ <​db_name>​ > dump.sql mysqldump -p<​pass>​ -u<​user>​ -h <​host>​ -P <​port>​ <​db_name>​ > dump.sql
-</sxh>+</code>
  
 ==== Dump the structure of a database ==== ==== Dump the structure of a database ====
-<sxh>+<code>
 mysqldump -p<​pass>​ -u<​user>​ -h <​host>​ -P <​port>​ --no-data <​db_name>​ > structure.sql mysqldump -p<​pass>​ -u<​user>​ -h <​host>​ -P <​port>​ --no-data <​db_name>​ > structure.sql
-</sxh>+</code>
  
 ==== Dump some tables of a database ==== ==== Dump some tables of a database ====
-<sxh>+<code>
 mysqldump -p<​pass>​ -u<​user>​ -h <​host>​ -P <​port>​ <​db_name>​ \ mysqldump -p<​pass>​ -u<​user>​ -h <​host>​ -P <​port>​ <​db_name>​ \
     table1 \     table1 \
Line 58: Line 59:
     table3 \     table3 \
      > dump.sql      > dump.sql
-</sxh>+</code>
  
 ==== Import the dump in a database ==== ==== Import the dump in a database ====
-<sxh>+<code>
 mysql -p<​pass>​ -u<​user>​ -h <​host>​ -P <​port>​ <​db_name>​ < dump.sql mysql -p<​pass>​ -u<​user>​ -h <​host>​ -P <​port>​ <​db_name>​ < dump.sql
-</sxh>+</code>
  
  • mysql.txt
  • Last modified: 2019/06/02 11:12
  • (external edit)