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..
Related
Backstory, I would like to build shiny apps to give to some of our data collectors so they can review what has been collected. We currently house all of our data in a cloud based MySQL server. Ideally, I would like the shiny app to pull data directly from the MySQL server so it can be fully automated without any data pulls and up 24/7.
I have been trying to first just build the connection between R and MySQL using the RMySQL package and can't seem to get it working. I have set up a specific username/password for this connection that is read only(however I have also tried my regular username which has all privileges granted). This is the code I am running;
mydb=dbConnect(
MySQL(),
user='myuser',
password='mypass',
dbname='vgtg',
host='ipaddress',
port=3306,
)
Obviously the 'ipaddress' of the server has been changed for the sake of posting here but it is a generic looking address like
'192.168.1.1'
When I run the code above I get this error message;
Error in .local(drv, ...) :
Failed to connect to database: Error: Can't connect to MySQL server on
'ipaddress' (0)
I have tried looking for previous questions posted but none seem to be exactly this error message that I am receiving. It makes me think that for some reason RMySQL is looking locally for the server when it is actually a cloud based, remote, server.
Also, is there anything more I should set up server side to allow the connection? I do have a server admin to help out but I am not sure how familiar he is with R and likewise I am not particularly familiar with working with servers. He has opened port 3306 for me and is able to see my attempts to connect through the port.
Your syntax is correct with the exception of
port=3306,
You need to drop the comma. That said, the error you received is unrelated to the syntax.
Without knowing the details of your setup, it is hard to diagnose. Where does the MySQL DB reside? For example, if it is on an AWS RDS instance, then the host isn't a standard IP address, it is something like this
mydb.cm1abc2v4mod.us-west-1.rds.amazonaws.com
Assuming that the IP address you used is correct, then the problem is most likely on the server. You need to ensure that port 3306 is open to traffic. Otherwise, R will not be able to connect to the DB.
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.
After reading multiple questions of users with problems like:
forgot password
installed multiple instances of MySQL
forgot to start MySQL
etc. etc
I started to consider if it is actually possible to conclude from the error page if MySQL is running at all?
Questions with the same type of answers:
mysql said: Cannot connect: invalid settings. xampp
phpMyAdmin - can't connect - invalid setings - ever since I added a root password - locked out
MySQL Says: Cannot connect: invalid settings
But does the error page actually say this is a mysql server response or it couldn't connect (server isn't running for instance)
Take the following code:
<?php
//Step1
$db = mysqli_connect('localhost','username','password','database_name')
or die('Error connecting to MySQL server.');
?>
If one of the inputs is incorrect you will get the error:
Error connecting to MySQL server.
This could be modified into a nice looking error message (as the image above).
So does the error actually prove that MySQL is running or not?
I found a video of a walkthrough on how to fix this error. In the video you can see the servers are running. I was pretty curious about this whole issue.
Link to Youtube:
https://www.youtube.com/watch?v=8fK_DYvosA8
I'm assuming if that's how it worked for the video, that's how it works in general. I'm working off the idea that something can't give you an error message unless it's running.
Sort of. phpMyAdmin generally returns the error message that it gets from MySQL, so for instance if the isn't a MySQL daemon listening on on the TCP/IP protocol, phpMyAdmin shows:
#2003 - Can't connect to MySQL server on '127.0.0.1' (111) — The server is not responding.
For an incorrect username or password, the error message is:
#1045 - Access denied for user 'root'#'localhost' (using password: YES)
"Invalid settings" usually means you have conflicting directives or incorrect information in one of your configuration statements. Without seeing your config.inc.php it's difficult to guess what's wrong here, but this also can mean something went wrong between the PHP library itself and MySQL.
The rejected connection message you posted can also have several causes.
Basically, to directly answer your question, you often can tell based on the error message returned by MySQL or the PHP library (which is the message phpMyAdmin shows). "Can't connect" means phpMyAdmin couldn't get any response from the MySQL daemon, which could have several causes but most often means MySQL isn't running. Most of the other error messages mean it's running but there was a problem connecting. Generally the error message contains some information about why.
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"
I was working on some tables in mysql, and out of no where, i got an error (Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.) Then i uninstalled xampp and tried to reinstall it. Then i got the error (phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.)
How can i get access again?