nsaenjoy.blogg.se

Mysql no database selected
Mysql no database selected













mysql no database selected

There is another way to select a database in MySQL. The output may look as below: +-+Ħ rows in set (0.00 sec) Selecting a database during login In this case, you need to find which databases are available on your server by using the show databases statement: show databases If the companydb database doesn’t exist, you’ll get the following error after executing the USE statement: ERROR 1049 (42000): Unknown database 'companydb'

mysql no database selected

To verify it, you can use the select database() statement: SELECT database()

mysql no database selected

If you see the following message, then it means that the command is successful. USE database_name įor example, the following statement set the current database to companydb in MySQL. To select a database, we need to use the USE statement. This will give the following output: ERROR 1046 (3D000): No database selected If you issue any statement, MySQL will issue an error. That means the current database is not set. Now, check the current database using the following statement. If everything goes well then you will see mysql> on the screen. You give the correct root password of the MySQL server and press enter. Let’s check:įirst, log in to the MySQL server Command Line Client tool using root user. Generally, when you logged into the MySQL Command Line tool without specifying the default database name, MySQL sets the current database to NULL. 1) Selecting database using MySQL Command Line tool This is because there might be more than one databases in the MySQL Server. Summary: in this tutorial, you will learn how to select a MySQL database using the USE command from the MySQL Command Line tool and MySQL Workbench.Īfter connecting to the MySQL instance, you need to select a particular database to start working with.















Mysql no database selected