MySQL in and around PLESK really useful commands

I’m always having to look up and figure out all this mysql stuff online. So I’m going to save my favourite commands here. I’ll try to include versions where I can…. Stay tuned.

OK, exporting ( dumping from a MySQL database ) in Plesk

mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` –add-drop-table –add-drop-database –default-character-set=latin1 mydb > db.sql

This bit `cat /etc/psa/.psa.shadow` grabs your PLESK MySQL password.

Add –add-drop-table if you’ll be exporting over an existing database or tables

Add –add-drop-database if you’ll be exporting over an existing database

mydb is the database you want to export from.

db.sql is the file you want to export to.

To import the file in to a database, connect to MySQL on your server

Go to the directory that has your db.sql file that you’re going to be importing

mysql -uadmin -p`cat /etc/psa/.psa.shadow` -p

Then enter the password

If you’re importing in to a new database:
The type in USE mydatabasename
Where mydatabasename is the name of the database you’re writing over

now type source db.sql;

remember to put the semi colon in there,
You should see a whole lot of
Query OK, 1 row affected (0.01 sec)
Lines, which is fine. Just wait it out and your import should complete all by itself.

MySQL in and around PLESK really useful commands: 1 комментарий

  1. bystac

    Here is an example of restarting mysql if compiled with mysql_safe deamon

    killall -9 mysqld_safe && killall -9 mysqld
    /usr/local/mysql/bin/mysqld_safe &

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *