简体   繁体   中英

(MySQL) named a database default somehow and cant work with it at all because MySQL workbench thinks im using the default data tyoe

Basically what it sounds like the database is named default

which was already there when i made the connection and the tables that are in it are inaccesible.

I've tried moving the tables to another database but mysql doesnt recognize that when i type default i mean the database and not the data type in mysql.

Any help? I goofed somehow and dont know how to fix it and havent found anything else like this problem online.

You can use any SQL reserved keyword as an identifier, but you must enclose them in back-ticks:

SELECT ... FROM `default`.admin ...

It's simpler if you move the tables to another schema that has a name that doesn't conflict with a reserved keyword.

Unfortunately, there's no RENAME SCHEMA statement in MySQL. You have to create a new schema and then RENAME TABLE to move them one by one.

CREATE SCHEMA my_awesome_schema;

RENAME TABLE `default`.admin TO my_awesome_schema.admin;
...same for other tables...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM