Connect to AWS RDS MySql database with Python - mysql

I am currently trying to connect to my MySql database created on AWS with a python program using the library PyMySQL.
import pymysql.cursors
connection = pymysql.connect(host='.blablablablabla.us-east.rds.amazonaws.com',
user='Username',
password='Password',
db='nameofmydb',
)
When I run the above code I get the following error:
pymysql.err.InternalError: (1049, "Unknown database 'nameofmydb'")
What am I doing wrong? The arguments I gave to the function are correct. Could it be a problem with the MySql driver?
Thank you in advance

The message is the standard one, returned by mysql server. It means what it says, it can not find the database. Doesn't look like a connectivity problem or a driver issue: it reaches the server and the server returns a message.
Just make sure you have created the database using the CREATE DATABASE command. Use the mysql CLI client to connect to the database and type SHOW DATABASES to see all the available databases.

Related

Unable to connect to 127.0.0.1:3306 in Mysql

I was creating a very large table using a python data set in the Mysql server, which I today realized was beyond the server's capacity.
Post which I am unable to connect to the server
I get the following error when I try to establish a connection on the MySQL workbench, I also get something similar when I try the same on python using MySQL connector
Following is a screenshot of the error
I tried setting up a new connection as follows, but I receive the same error:
I tried this solution, which is similar but I keep getting the following error
'mysql' is not recognized as an internal or external command,
operable program or batch file.
Is there any other way I can connect, or if there is anything I have to do before I can connect?
127.0.0.1 this server not get . Try to reconnect in another address..

Pentaho connecting to MySQL database

I am working on Pentaho Data Integration tool version 7.1. I am trying to connect to a database using 'Table Input' step. but when I test the connection in this step in Pentaho it is giving me the below error message. I am able to connect to DB using the MySQL workbench (MySQL is 5.7). I have placed the 'mysql-connector-java-5.1.23-bin.jar' file in the lib folder. My Java is 1.8.0-131; I am using Windows 10.
Error connecting to database [mydb] :org.pentaho.di.core.exception.KettleDatabaseException:
Error occurred while trying to connect to the database
Error connecting to database: (using class org.gjt.mm.mysql.Driver)
Unknown database 'mydb'
Make sure your pentaho version supports mysql connector .if it is not, download the required version and paste -> extract the file and paste it in the
\pdi-ce-8.2.0.0-342\data-integration\lib
After that open spoon.bat goto menu ->tool->marketplace ->install
mysql plugin
Restart pentaho after installing mysql plugin.
then try connecting to mysql .Hope it will solve your issue
It looks like the JDBC does not find your database. It may come from a typing mistake in the name, password, that the user has not enough grant,...
To debug use the test button on the bottom of the new connection button:

Error in configuring MySql workbench - Failed to connect to MySql at localhost

I am new to MySql workbench and never needed to use a lot of DBs before now.
I had an sql script containing all the DB creation, tables, population etc.
So using MySql workbench, I Reversed Engineering Using a Create Script.
Fine, it worked as I can see my tables.
Now I want perform some select over my data and I first need to create a new connection,
So I tried to Creating a MySQL Connection
but when I test the connection, I get the following error: "Failed to connect to MySql server on 127.0.0.1" (10061).
Question: what to use in the below menu (Connection/RemoteManagement/System Profile) or what else could be my problem?
my problem was that I didnt have a db, so I decided to use wampserver which includes everything and it's very simple to use.

Connecting Scala and Play-Slick to AWS MySQL

Having difficulty connecting to AWS MySQL database in a new Scala Play Slick application. I can connect to the database from MySQL Workbench.
application.conf contains:
db.default.user=myusername
db.default.password=mypassword
db.default.driver=com.mysql.jdbc.Driver
The problem may be in db.default.url=
The MySQL Workbench copy JDBC connection string command yields:
"jdbc:mysql://sperch-dev.coafgaprx2uf.us-east-1.rds.amazonaws.com:3306/?user=myusername"
Including the "user=" here as MySQL Workbench suggests seems redundant with db.default.user and anyway I get the error message "[SQLException: No database selected]" with or without it.
Having seen elsewhere the pattern for db.default.url as:
"jdbc:mysql://localhost:3306/DATABASENAME?characterEncoding=UTF-8"
I tried adding the database name:
"jdbc:mysql://sperch-dev.coafgaprx2uf.us-east-1.rds.amazonaws.com:3306/sperch-dev?characterEncoding=UTF-8"
That however generates the error message:
"Cannot connect to database [default]"
My db.default.user and db.default.password are the same as the working connection in MySQL Workbench.
Any suggestions?
Remove the Port number and user name from the db.default url. Below is an example of what works.
# Database configuration
db.default.driver=com.mysql.jdbc.Driver
db.default.url="jdbc:mysql://your-rds-instance.us-west-1.rds.amazonaws.com/DATABASE_SCHEMA_HERE"
db.default.user=user
db.default.pass="password"

how to connect Coldfusion to a MySQL database

total newbie and totally lost...
I'm trying to setup coldfusion(8) with a mysql(5.5) database on a local (apache 2.2) webserver running Windows XP.
Coldfusion and Apache are running, but I don't know how to fiddle this in with MySQL.
I'm doing the following:
- Import file1.sql and file2.sql into MySql workbench (5.2) by reverse engineering
- Save this new model as base.mwb into my Apache htdocs folder
- Open the Coldfusion Administrator Data Sources
- Add new Source "myName", Database "base", localhost, 3306, root, password
When I try to add I always get Unknown database 'base' error.
I also tried to make a connection in MySQL or set up a new server instance in MySQL workbench, but these also fail because of no database "base".
I guess I'm missing something (probably a database :-)... Thanks for some pointers or a dummy tutorial. I'm longing for something to show up in http://localhost...
I would have to guess that you are coming from a background using Access DBs. MySQL and ColdFusion do not work together by have a DB file in the CF application. CF connects to a running MySQL server somewhere on your network (even on the same machine) using a JDBC connection. It does not look at a DB file and use that. So you will need to install MySQL Server and then import the DB into that. Then use CF's datasources to connect with that.