How do I stop using a database?
To start mysql, you can use:
mysql -u root -pXXXX<ENTER>
At this time, no database is selected. We'll call this
state 1
To select (or use) a database:
use "MyDB";
.....My operations or queries
Now, I want to return to state 1 (without any database selected). How I can do that? I can select another database, but I don't want to do that.
The mysql schema is the system schema. It contains tables that store information required by the MySQL server as it runs. A broad categorization is that the mysql schema contains data dictionary tables that store database object metadata, and system tables used for other operational purposes.
Steps to create a schema in MySQLOpen the MySQL Workbench. Click the Create Schema option. Provide a schema name.
You can't currently change a user's privileges in the control panel, so to do so you need to use a command-line MySQL client like mysql . After you create a user in the cluster, connect to the cluster as doadmin or another admin user.
What you are asking for is not possible. The only way to return to that state is to disconnect and then reconnect.
If you are just looking to switch away from your current db, you can switch to a system database, such as the internal "mysql" database:
use mysql
Or you could create an empty database and use that:
create database empty;
use empty
Accidentally, I got the answer. Is not commands or statement.
CREATE DATABASE UnselectingDB;
USE UnselectingDB;
DROP DATABASE UnselectingDB;
Best Regards,
You can test that with (to know what is the selected DB)
SELECT DATABASE();
Step by step...
mysql -u root -pXXXX<ENTER>
At this step you can check that you don't have any selected Database, the answer is NULL
SELECT DATABASE();
Now you can to select any Database and make your operations
USE mysql;
/*your aditional operations*/
You can check wich is the selected Database, for this example is mysql
SELECT DATABASE();
Now, we need to create other database, not to delete any that is useful.
CREATE DATABASE StopUsingAnyDB;
Later, We need to select the recently created database.
USE StopUsingAnyDB;
You can check wich is the selected Database, for this example is StopUsingAnyDB
SELECT DATABASE();
Last. We delete the selected database
DROP DATABASE UnselectingDB;
You can check wich is the selected Database, for this example is NULL again.
SELECT DATABASE();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With