This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-17. For the latest, interactive version please visit https://mariadb.com/kb/.

Access to more databases

Hello, I would like to know what is the correct way to access two databases on the same server, with two different names, but the same structure (same field tables). I tried to access alternatively one or the other database only by changing the database name, but the data from one database was mixed with the other ! In both insert and select queries, I use the table name without the database prefix (for example "select * from myTable"). Do I have to use "select * from myDatabase.myTable"? Thank you

Answer Answered by Alberto Bonardi in this comment.

Hello, I tried to set "USE myDbName" when opening the database, but unfortunately something is wrong because I keep seeing the data from the other database. Unfortunately I'm afraid I'll have to modify all the queries by adding the prefix with the database name! Thanks anyway

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.