changing database
This is a discussion on changing database within the MySQL forums, part of the Database category; I have two databases: office01 and office02 is it possible to choose the database by commandline (instead of changing from ...
-
changing database
I have two databases: office01 and office02
is it possible to choose the database by commandline (instead of changing from ODBC), such as:
C:\> mysql.exe -umainuser -pmainpass ...
thanks for the help
regards,
Jerry
-
Dear Jerry,
It is possible to change or switch to a different database at any time.
Main consideration here is that you need to have the "rights" to access the database.
Initially the database which is passed in as a command line argument is selected automatically.
However, you can change the initially selected database to another database at any point of time.
To change or select a particular database:
use [database name];
Use the same method to switch back to initial database (if required)
Use office01
SELECT * FROM of1table01
Use office02
SELECT * FROM of2table01
Alternatively you can add the database name prefixed to the table name directly in the query itself (irrespective of whichever database you have used).
Main consideration here is that you need to have permission to access both office01 as well as office02
SELECT * FROM office01.of1table01;
SELECT * FROM office02.of2table01;
I hope this helps
Thanks and Regards
Lokesh M.


Reply With Quote





