admin:mysql

MySQL / MariaDB Administration

# backup all databases
mysqldump -u root -p --all-databases | gzip -9 > [backupfile.sql.gz]
 
# backup specific DB
mysqldump -u root -p --databases db1 db2 db3 | gzip -9 > [backupfile.sql.gz]
 
# restore specific DB
gunzip < [backupfile.sql.gz] | mysql -u [uname] -p[pass] [dbname]
 
# import into already existing DB
mysqlimport -u [uname] -p[pass] [dbname] [backupfile.sql]
Error 150 is related to foreign key relations. Receiving this error means that a foreign key was defined in the table to be altered and it cannot be dropped as its properties are still valid. (source)
use databasename
SET FOREIGN_KEY_CHECKS = 0;
\. sqlscript.sql
SET FOREIGN_KEY_CHECKS = 1;

http://bugs.mysql.com/bug.php?id=16181

Check if the charsets and collations match.

  • Last modified: 2019-12-20 14:21