LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Error when trying to connect to MySQL Server (https://www.linuxquestions.org/questions/linux-newbie-8/error-when-trying-to-connect-to-mysql-server-927795/)

gammaman 02-05-2012 04:47 PM

Error when trying to connect to MySQL Server
 
Hello,

I am trying to connect to mysql server. I am running Ubuntu Server on VM which is running on Windows. I am getting the following error.

Lost connection to MySQL server at 'reading initial communication packet', system error: 111

These are the steps I have done so far.

1. Install mysql
2. Modified the bind-address in /etc/mysql/my.cnf to change to the Ubuntu Server IP.
3. Ran sudo /etc/init.d/mysql restart

When I try to access the database via a php connection who's files also sit on this server at /var/www/myfolder. I get the error.

Lost connection to MySQL server at 'reading initial communication packet', system error: 111


I have also made changes to a config.php file to match the settings of the sql database.

// Database Settings
$GLOBALS['database'] = 'dbsv1'; // Enter the name of the database here
$GLOBALS['user'] = 'myusername'; // Enter the username for the database
$GLOBALS['pass'] = 'mypassword'; // Enter the password for the username
$GLOBALS['hostname'] = '192.168.1.1'; // Enter the hostname that is serving the database

Any ideas as to why I am getting this error?

klearview 02-05-2012 05:18 PM

Quote:

"2. Modified the bind-address in /etc/mysql/my.cnf to change to the Ubuntu Server IP."
Quote:

php connection who's files also sit on this server at /var/www/myfolder
Why would you change bind address then?!

chrism01 02-05-2012 05:19 PM

firewall/iptables ?
Can you connect at the cmd line locally and/or remotely?

gammaman 02-06-2012 03:41 AM

Sorry, my bad. I fat fingered the host address in the php file. Now I am getting another error.

Unable to connect: Host 'ubuntu.home' is not allowed to connect to this MySQL server.

klearview 02-06-2012 04:13 AM

Judging by this thread with me and you

http://www.linuxquestions.org/questi...indows-927752/

can I advice that you pick up some beginner book or a howto to gain some very basic understanding of networking, Apache, MySQL etc.

You are getting this error because presumably you failed to grant the appropriate MySQL user the right to connect from wherever you are connecting from.


All times are GMT -5. The time now is 07:18 PM.