LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-05-2012, 05:47 PM   #1
gammaman
LQ Newbie
 
Registered: Feb 2012
Posts: 7

Rep: Reputation: Disabled
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?
 
Old 02-05-2012, 06:18 PM   #2
klearview
Member
 
Registered: Aug 2006
Location: London
Distribution: Debian, Kubuntu
Posts: 572

Rep: Reputation: 75
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?!
 
Old 02-05-2012, 06:19 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
firewall/iptables ?
Can you connect at the cmd line locally and/or remotely?
 
Old 02-06-2012, 04:41 AM   #4
gammaman
LQ Newbie
 
Registered: Feb 2012
Posts: 7

Original Poster
Rep: Reputation: Disabled
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.
 
Old 02-06-2012, 05:13 AM   #5
klearview
Member
 
Registered: Aug 2006
Location: London
Distribution: Debian, Kubuntu
Posts: 572

Rep: Reputation: 75
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. NoviceW Linux - Networking 17 09-17-2014 03:13 PM
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. SpellChainz Linux - Software 3 06-28-2007 12:46 PM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. SpellChainz Linux - Newbie 1 06-23-2007 04:35 PM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 09:44 AM


All times are GMT -5. The time now is 12:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration