Connect to Mysql server to run tasks on two databases -


i writing script perform tasks between 2 mysql databases on same server, i.e truncate tables on 1 db , import table rows db one.

the user doing tasks has full permissions on both databases.

how connect both databases command line?

thanks in advance help.

you can use mysqlcommand line utility proper parameters:

mysql -u root -h your_host -p your_db 

here root privileged user , your_db database in use default. can switch between databases typing use another_db command mysqlconsole.

also note not have select dabase (use db_name) in order execute query on it. can example write query this:

select a.id, b.title db1.table1 left join db2.table b on b.id = a.foreign_id 

Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -