Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente Prochaine révisionLes deux révisions suivantes |
technique:mysql [2018/04/06 23:14] – francoisa | technique:mysql [2020/09/28 10:58] – [Connexion] francoisa |
---|
| |
===== Connexion ===== | ===== Connexion ===== |
| |
mysql ‐u nomutilisateur ‐p SHOW DATABASES; USE nomdelabdd; SHOW TABLES; DESCRIBE nomdelatable; | |
| |
===== Actions sur bases ===== | |
| |
CREATE DATABASE nomdelabdd; DROP DATABASE nomdelabdd; | |
| |
CREATE TABLE nomdelatable ( nomcolonne1 INT, nomcolonne2 FLOAT, nomcolonne3 VARCHAR(50), nomcolonne3 CHAR(50) ); | |
| |
DROP TABLE nomdelatable; | |
| |
''DELETE FROM nom_de_la_table WHERE nom_de_l'entree="valeur de l'entre"'' | |
| |
Se connecter à MySQL en ligne de commande sous Linux : | Se connecter à MySQL en ligne de commande sous Linux : |
<code> | <code> |
mysql ‐u nomutilisateur ‐p | mysql ‐u nomutilisateur ‐p |
| |
</code> | </code> |
| |
<code> | <code> |
SHOW DATABASES; | SHOW DATABASES; |
| |
</code> | </code> |
| |
<code> | <code> |
USE nomdelabdd; | USE nomdelabdd; |
| |
</code> | </code> |
| |
<code> | <code> |
SHOW TABLES; | SHOW TABLES; |
| |
</code> | </code> |
| |
<code> | <code> |
DESCRIBE nomdelatable; | DESCRIBE nomdelatable; |
| |
</code> | </code> |
| |
| |
<code> | <code> |
CREATE DATABASE nomdelabdd; | CREATE DATABASE nomdelabdd; |
</code> | </code> |
| |
| |
<code> | <code> |
DROP DATABASE nomdelabdd; | DROP DATABASE nomdelabdd; |
</code> | </code> |
| |
| |
<code> | <code> |
CREATE</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>TABLE</font> nomdelatable</font> | CREATE TABLE nomdelatable ( nomcolonne1 INT , nomcolonne2 FLOAT , nomcolonne3 VARCHAR ( 50 ), nomcolonne3 CHAR ( 50 ) ); |
<font inherit/inherit;;#000000 font-weight: bold;;inherit>(</font> | |
nomcolonne1</font> <font inherit/inherit;;#204a87;;inherit>INT</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>,</font> | |
nomcolonne2</font> <font inherit/inherit;;#204a87;;inherit>FLOAT</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>,</font> | |
nomcolonne3</font> <font inherit/inherit;;#204a87;;inherit>VARCHAR</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>(</font><font inherit/inherit;;#0000cf font-weight: bold;;inherit>50</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>),</font> | |
nomcolonne3</font> <font inherit/inherit;;#204a87;;inherit>CHAR</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>(</font><font inherit/inherit;;#0000cf font-weight: bold;;inherit>50</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>)</font> | |
<font inherit/inherit;;#000000 font-weight: bold;;inherit>);</font> | |
</code> | </code> |
| |
| |
<code> | <code> |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>DROP</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>TABLE</font> nomdelatable</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>;</font> | DROP TABLE nomdelatable ; |
</code> | </code> |
| |
| |
<code> | <code> |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>ALTER</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>TABLE</font> nomdelatable</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>ADD</font> nomdecolonne</font> <font inherit/inherit;;#204a87;;inherit>INT</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>;</font> | ALTER TABLE nomdelatable ADD nomdecolonne INT ; |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>ALTER</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>TABLE</font> nomdelatable</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>ADD</font> nomdecolonne1</font> <font inherit/inherit;;#204a87;;inherit>VARCHAR</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>(</font><font inherit/inherit;;#0000cf font-weight: bold;;inherit>50</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>);</font> | ALTER TABLE nomdelatable ADD nomdecolonne1 VARCHAR ( 50 ); |
</code> | </code> |
| |
<code> | <code> |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>ALTER</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>TABLE</font> nomdelatable</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>ADD</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>COLUMN</font> nomdelacolonne</font> <font inherit/inherit;;#204a87;;inherit>INT</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>;</font> | ALTER TABLE nomdelatable ADD COLUMN nomdelacolonne INT ; |
</code> | </code> |
| |
| |
<code> | <code> |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>ALTER</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>TABLE</font> nomdelatable</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>DROP</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>COLUMN</font> nomdecolonne1</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>;</font> | ALTER TABLE nomdelatable DROP COLUMN nomdecolonne1 ; |
</code> | </code> |
| |
| |
<code> | <code> |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>ALTER</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>TABLE</font> nomdelatable</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>RENAME</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>AS</font> lenouveaunomdelatable</font> | ALTER TABLE nomdelatable RENAME AS lenouveaunomdelatable |
</code> | </code> |
| |
<code> | <code> |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>ALTER</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>TABLE</font> nomancientable</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>RENAME</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>TO</font> nomnouveautable</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>;</font> | ALTER TABLE nomancientable RENAME TO nomnouveautable ; |
</code> | </code> |
| |
<code> | <code> |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>RENAME</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>TABLE</font> nomancientable</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>TO</font> nomnouveautable</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>;</font> | RENAME TABLE nomancientable TO nomnouveautable ; |
</code> | </code> |
| |
| |
<code> | <code> |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>ALTER</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>TABLE</font> nomdelatable</font> CHANGE</font> nomdelacolonne</font> nouveaunomdelacolonne</font> <font inherit/inherit;;#204a87;;inherit>INT</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>;</font> | ALTER TABLE nomdelatable CHANGE nomdelacolonne nouveaunomdelacolonne INT ; |
</code> | </code> |
| |
| |
<code> | <code> |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>ALTER</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>TABLE</font> nomdelatable</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>ADD</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>PRIMARY</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>KEY</font> <font inherit/inherit;;#000000 font-weight: bold;;inherit>(</font>nomcolonne</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>);</font> | ALTER TABLE nomdelatable ADD PRIMARY KEY ( nomcolonne ); |
</code> | </code> |
| |
<code> | <code> |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>ALTER</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>TABLE</font> nomdelatable</font> | ALTER TABLE nomdelatable ADD CONSTRAINT pk_nomdelacontrainte PRIMARY KEY ( nomcolonne ); |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>ADD</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>CONSTRAINT</font> pk_nomdelacontrainte</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>PRIMARY</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>KEY</font> <font inherit/inherit;;#000000 font-weight: bold;;inherit>(</font>nomcolonne</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>);</font> | |
</code> | </code> |
| |
| |
<code> | <code> |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>ALTER</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>TABLE</font> nomdelatable</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>DROP</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>PRIMARY</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>KEY</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>;</font> | ALTER TABLE nomdelatable DROP PRIMARY KEY ; |
</code> | </code> |
| |
| |
<code> | <code> |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>ALTER</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>TABLE</font> nomdelatable</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>ADD</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>CONSTRAINT</font> fk_nomdelacontrainte</font> | ALTER TABLE nomdelatable ADD CONSTRAINT fk_nomdelacontrainte FOREIGN KEY ( nomcolonne ) REFERENCES tabledereference ( nomcolonne ); |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>FOREIGN</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>KEY</font> <font inherit/inherit;;#000000 font-weight: bold;;inherit>(</font>nomcolonne</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>)</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>REFERENCES</font> tabledereference</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>(</font>nomcolonne</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>);</font> | |
</code> | </code> |
| |
| |
<code> | <code> |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>ALTER</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>TABLE</font> nomdelatable</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>DROP</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>CONSTRAINT</font> fk_nomdelacontrainte</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>;</font> | ALTER TABLE nomdelatable DROP CONSTRAINT fk_nomdelacontrainte ; |
</code> | </code> |
| |
| |
<code> | <code> |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>SELECT</font> nomcolonne</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>FROM</font> nomtable</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>;</font> | SELECT nomcolonne FROM nomtable ; |
</code> | </code> |
| |
| |
<code> | <code> |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>SELECT</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>DISTINCT</font> nomcolonne</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>FROM</font> nomtable</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>;</font> | SELECT DISTINCT nomcolonne FROM nomtable ; |
</code> | </code> |
| |
| |
<code> | <code> |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>SELECT</font> nomcolonne</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>FROM</font> nomtable</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>WHERE</font> nomcolonne</font> <font inherit/inherit;;#ce5c00 font-weight: bold;;inherit>=</font> <font inherit/inherit;;#4e9a06;;inherit>'1'</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>;</font> | SELECT nomcolonne FROM nomtable WHERE nomcolonne = '1' ; |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>SELECT</font> nomcolonne</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>FROM</font> nomtable</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>WHERE</font> nomcolonne</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>LIKE</font> <font inherit/inherit;;#4e9a06;;inherit>'%.com'</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>;</font> | SELECT nomcolonne FROM nomtable WHERE nomcolonne LIKE '%.com' ; |
</code> | </code> |
| |
| |
<code> | <code> |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>SELECT</font> colonne1</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>,</font> colonne2</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>,</font> colonne3</font> | SELECT colonne1 , colonne2 , colonne3 FROM table1 INNER JOIN table2 ON table1 . colonne1 = table2 . colonne3 WHERE colonne1 = 'cequejecherche' |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>FROM</font> table1</font> | |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>INNER</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>JOIN</font> table2</font> | |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>ON</font> table1</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>.</font>colonne1</font><font inherit/inherit;;#ce5c00 font-weight: bold;;inherit>=</font>table2</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>.</font>colonne3</font> | |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>WHERE</font> colonne1</font> <font inherit/inherit;;#ce5c00 font-weight: bold;;inherit>=</font> <font inherit/inherit;;#4e9a06;;inherit>'cequejecherche'</font> | |
</code> | </code> |
| |
| |
<code> | <code> |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>UPDATE</font> nomtable</font> | UPDATE nomtable SET nomcolonne1 = 'mavaleur' , nomcolonne2 = 'mavaleur2' |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>SET</font> nomcolonne1</font><font inherit/inherit;;#ce5c00 font-weight: bold;;inherit>=</font><font inherit/inherit;;#4e9a06;;inherit>'mavaleur'</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>,</font>nomcolonne2</font><font inherit/inherit;;#ce5c00 font-weight: bold;;inherit>=</font><font inherit/inherit;;#4e9a06;;inherit>'mavaleur2'</font> | |
</code> | </code> |
| |
| |
<code> | <code> |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>UPDATE</font> nomtable</font> | UPDATE nomtable SET nomcolonne1 = 'mavaleur' , nomcolonne2 = 'mavaleur2' WHERE nomcolonne3 = '0' |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>SET</font> nomcolonne1</font><font inherit/inherit;;#ce5c00 font-weight: bold;;inherit>=</font><font inherit/inherit;;#4e9a06;;inherit>'mavaleur'</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>,</font>nomcolonne2</font><font inherit/inherit;;#ce5c00 font-weight: bold;;inherit>=</font><font inherit/inherit;;#4e9a06;;inherit>'mavaleur2'</font> | |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>WHERE</font> nomcolonne3</font> <font inherit/inherit;;#ce5c00 font-weight: bold;;inherit>=</font><font inherit/inherit;;#4e9a06;;inherit>'0'</font> | |
</code> | </code> |
| |
| |
<code> | <code> |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>INSERT</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>INTO</font> nomtable</font> <font inherit/inherit;;#000000 font-weight: bold;;inherit>(</font>colonne1</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>,</font>colonne2</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>,</font>colonne3</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>)</font> | INSERT INTO nomtable ( colonne1 , colonne2 , colonne3 ) VALUES ( valeu1 , valeur2 , valeur3 ); |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>VALUES</font> <font inherit/inherit;;#000000 font-weight: bold;;inherit>(</font>valeu1</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>,</font>valeur2</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>,</font>valeur3</font><font inherit/inherit;;#000000 font-weight: bold;;inherit>);</font> | |
</code> | </code> |
| |
| |
<code> | <code> |
<font inherit/inherit;;#204a87 font-weight: bold;;inherit>DELETE</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>FROM</font> nomtable</font> <font inherit/inherit;;#204a87 font-weight: bold;;inherit>WHERE</font> nomcolonne</font><font inherit/inherit;;#ce5c00 font-weight: bold;;inherit>=</font><font inherit/inherit;;#4e9a06;;inherit>'lavaleur'</font> | DELETE FROM nomtable WHERE nomcolonne = 'lavaleur' |
| |
| </code> |
| |
| Trouver la valeur Maximal d'une colonne et ne garder que celle ligne : |
| |
| <code> |
| SELECT MAX(macolonne) FROM YourTable |
| |
| </code> |
| |
| |
| ===== Sauvegardes ===== |
| |
| Pour sauvegarder toutes les bases de données on utilise la commande suivante : |
| |
| <code> |
| mysqldump --user=mon_user --password=mon_password --all-databases> fichier_destination.sql |
| |
| </code> |
| |
| Pour sauvegarder une base de données précise : |
| |
| <code> |
| mysqldump --user=mon_user --password=mon_password --databases nom_de_la_base> fichier_destination.sql |
| |
| </code> |
| |
| Pour sauvegarder plusieurs bases de données : |
| |
| <code> |
| mysqldump --user=mon_user --password=mon_password --databases nom_de_la_base_1 nom_de_la_base_2> fichier_destination.sql |
| |
| </code> |
| |
| Pour sauvegarder une table précise : |
| |
| <code> |
| mysqldump --user=mon_user --password=mon_password --databases nom_de_la_base --tables nom_de_la_table> fichier_destination.sql |
| |
| </code> |
| |
| Pour sauvegarder plusieurs tables : |
| |
| <code> |
| mysqldump --user=mon_user --password=mon_password --databases nom_de_la_base --tables nom_de_la_table_1 nom_de_la_table_2> fichier_destination.sql |
| |
| </code> |
| |
| Pour tous ces types de sauvegarde mysql les fichiers générés sont en .sql. Cela dit on peut mettre l’extension que l’on veut comme .txt par exemple. Ca n’a pas d’importance. Les fichiers sont lisibles en clair et contiennent toutes les commandes SQL pour pouvoir faire une restauration mysql. |
| |
| Cela dit les fichiers .sql sont volumineux. Pour gagner de la place, on va les compresser à la volée lors de la sauvegarde. |
| |
| ==== Compresser la sauvegarde mysql ==== |
| |
| Pour compresser les données, nous allons utiliser gunzip après avoir invoqué mysqldump. |
| |
| Cela donnera des commandes du type : |
| |
| <code> |
| mysqldump <commandes> | gzip> fichier_destination.sql.gz |
| |
| </code> |
| |
| Exemple avec la commande de sauvegarde complète :<code> |
| |
| mysqldump --user=mon_user --password=mon_password --all-databases | gzip> fichier_destination.sql.gz |
| |
| </code> |
| |
| A noter qu’avec cette méthode, la commande de sauvegarde mysql produit un seul fichier compressé. le fichier source n’existe plus. |
| |
| ==== Restauration MySql ==== |
| |
| Pour la restauration mysql on n’utilise plus la commande mysqldump. On utilise la commande mysql. La commande mysql va aller lire un fichier puis le restaurer en fonction de son contenu et de ses instructions. |
| |
| La restauration mysql peut se faire pour toutes les bases de données ou pour un base de données précise. |
| |
| Exemple sans distinction de base de données :<code> |
| |
| mysql --user=mon_user --password=mon_password <fichier_source.sql |
| |
| </code> |
| |
| Autre exemple pour restaurer dans une base de données précise : |
| |
| <code> |
| mysql --user=mon_user --password=mon_password nom_de_la_base <fichier_source.sql |
| |
| </code> |
| ==== Backup complet SQL des bases ==== |
| |
| Pour toutes les bases : |
| |
| <code> |
| mysqldump --user=root --password=XXX --all-databases> alldatabases-`date +%Y%m%d-%H%M`.sql |
| |
| </code> |
| |
| Script complet de backup à adapter : |
| |
| <code> |
| #!/usr/bin/env bash |
| |
| SQL_USER="root" |
| SQL_PASS="XXX" |
| SQL_HOST="localhost" |
| |
| FILE_PREFIX="backup_db" |
| |
| FILE_DATE=`date +%Y-%m-%d-%H-%M-%S` |
| TARGET_FILE_PATH="/root/Backups/" |
| mkdir -p "$TARGET_FILE_PATH" |
| |
| DATABASES=$(mysql -h $SQL_HOST -u $SQL_USER --password=$SQL_PASS -e "SHOW DATABASES;" | tr -d " | " | grep -v -e Database -e _schema -e mysql) |
| |
| for DB_NAME in "$DATABASES"; do |
| mysqldump -h $SQL_HOST -u $SQL_USER --password=$SQL_PASS --single-transaction --skip-lock-tables "$DB_NAME"> "$TARGET_FILE_PATH""$FILE_PREFI$ |
| gzip "$TARGET_FILE_PATH""$FILE_PREFIX"."$DB_NAME"."$FILE_DATE".sql |
| done |
</code> | </code> |
| |