
Once done, you will need to re-enter your database password in the prompt window one more time.ģ. Password: click on Store in Vault … and type in your database password SSH Password: click on Store in Vault … and type in your cPanel password SSH Hostname: your server hostname and port (e.g., :21098) When asked for your password enter it (see above) Click on the tile to connect to your database. Enter your database username (see above) Click Ok. Enter the hostname with the database server name (see above) Leave the default port of 3306. The setup window will show up, fill out the fields as follows:Ĭonnection Method: Standard TCP/IP over SSH From the menu select Database > Connect to Database. Open your Workbench application > Database > Connect to database to add a new connection or click on + icon. Follow the steps from this guide or contact our hosting support via live chat or the ticket system to enable SSH access for your account.Ģ. To connect to your MySQL database with the Workbench software you should do the following:ġ. Set up an SSH tunnel between your PC and our server using SSH-tunneling with the Is disabled on our shared servers due to security reasons, but you can easily You can also select the database after login into the MySQL Workbench by using Set as Default Schema feature or by issuing the USE statement.How to connect to a database using the Workbench MySQL client If you are using the MySQL Workbench application to connect MySQL instance, you can select a database by specifying the database name in the Default Schema: text box as shown in the following screenshot. Next, we go to Connection Method menu > select Standard TCP/IP over SSH. We select the Remote Host option and enter the URL you received when you created the database instance. ERROR 1049 (42000): Unknown database 'customerdb' Selecting a database in MySQL Workbench Then, we launch MySQL Workbench, select Server Administration > New Server Instance option. This will give the following error even after providing the correct root password for MySQL. What will happen if you provide the database name during login that does not exist.įor example, you provide one database customerdb which does not exist in the MySQL. This will display the output as below: +-+ After successful login, you can then check the current database using the following statement. You give the correct root password and press enter. Same as before, this will ask for MySQL root password. In this method, you can specify the name of the database while logging into the MySQL server using the Command Line tool by mentioning the -D flag followed by the database name.įor example, if you want to select the companydb as the default database, you specify the companydb after the -D flag as below: mysql -u root -D companydb -p 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' To verify it, you can use the select database() statement: SELECT database() 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. Enter either the user specified in the Atlas connect dialog or a different database user for the cluster. This tutorial uses MySQL Workbench to access and modify the database. Let’s check:įirst, log in to the MySQL server Command Line Client tool using root user. A data visualization tool is a common way to interact with the database. To create a schema for the Database provide default.


Generally, when you logged into the MySQL Command Line tool without specifying the default database name, MySQL sets the current database to NULL. Provide the Connection name, connection method should be standard (TCP/IP) and change the port to 3307. 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.
