6

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"

2
  • 1
    Hi Eduardo, if the below answer helped resolve your problem please upvote and accept it. That's the ServerFault way to say thanks to people who spent their free time answering your question. Thanks!
    – MLu
    Nov 20 '18 at 23:53
  • @MLu Tnak you for the answer and Im sorry. I didnt knew I had the level to do that im new to sf Nov 29 '18 at 9:41
4

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.

1
  • 1
    This fixed my problem, if you create an RDS DB instance with "Easy create" you skip over this step so make sure to use "Standard create"
    – Ken
    Apr 29 at 3:15
7

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 :)

1

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.

1
  • the weird is, how aws rds display the info about db configurations: db instance, db name etc ... Nov 7 '19 at 10:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.