Unknown Database when trying to connect to an AWS RDS instance

I created a MySQL RDS instance, however, when I try to connect without writing the database name, it connects but does not allow me to create any tables. When I do write the name, the connection fails and I don't know why.

Error

Error screen shot Working screen shot

I have my endpoint, user, password and the name of the DB, which is prueba (test in spanish)

AWS Console

AWS Console

As you can see, the name of the instance is "prueba". And when it asked me to enter the name of the DB in he console, I also worte "prueba"


When you create you create your RDS instance, there is an “Additional configuration” section, in which you can specify the database name, and it warns you that if no name is provided, no database will be created by default.

enter image description here

But as others have pointed out, you can connect with your tool of choice without a database name, perform a CREATE DATABASE xxx; where xxx is the name of the database, and then use can use that database going forward.


The name that you circled in the second screenshot is not a mysql database name, it's merely an identifier how your database instance is known as in AWS, i.e. endpoint name. These may be different!

Since logging in without specifying the MySQL database name works it means your connectivity and credentials are correct. You can't create tables because you didn't select a database where to create these tables.


So why can't you connect with a database name specified?

I suspect your default database name that was created by AWS when setting up the RDS instance isn't prueba but something else. You should be able to figure that you in the RDS Details tab:

Database Details

Note that my Endpoint Name is prueba but the MySQL Database Name is something.

I can login to the RDS and list the databases:

~ $ mysql -h prueba.xxxxxxxxxx.ap-southeast-2.rds.amazonaws.com -uroot -p
Enter password: 
Server version: 5.6.40 Source distribution

MySQL [(none)]> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| innodb             |
| mysql              |
| performance_schema |
| something          |      <<<< Here is my "default" database
| sys                |
+--------------------+
6 rows in set (0.04 sec)

So to wrap it up - you'll have to figure out your actual mysql database name:

  • find out what was the default database name that you specified when creating the instance from the RDS Details screen, or
  • find out the database name by logging in without a db name specified and then run SHOW DATABASES;, or
  • create a new one using CREATE DATABASE whatever; or using some dialog in your DB tool.

Once you've got the database name you can then connect to it in your connect dialog or with USE whatever; and then you can finally create your tables.

Hope that helps :)


You can't create tables without creating a database first. Login without db name, create a new database and then create tables. That will work.