Frequently asked questions


How do I run an SQL script?

For running SQL scripts, you can run the regular mysql command in combination with the program cat. This is also a method of retrieving backup made with mysqldump. If so, make sure the tables are not already existing.

cat filename.sql | mysql --binary-mode DATABASE NAME -uUSERNAME -hDATABASE -p

You will be asked for your MySQL password. If you need to automate this, you may consider creating a .my.cnf file with your password. Make sure that the file is readable onlyfor your own Unix user!.

If the file is zipped with gzip:

zcat filename.sql.gz | mysql --binary-mode DATABASE NAME -uUSERNAME -hDATABASE -p

Substitute file name.sql or file name.sql.gz with the file name of your SQL script.

See also:

© 2024 Domeneshop AS · About us · Terms · Privacy policy