LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-28-2005, 07:54 PM   #1
Jukas
Member
 
Registered: Mar 2005
Posts: 141

Rep: Reputation: 15
Mysql remote connection issue


I'm running Debian 3x (Sarge) and I installed Mysql with apt-get . I can see it running, and I can access the mysql> prompt from a ssh shell but I cannot access it from outside the local box. I checked to be sure my firewall wasn't blocking it, and when I try and connect I get the following error message:

Error 1130: #HY000Host 'x.x.x.x' is not allowed to connect to this MySQL server

I checked the mysql site, and they mentioned if it was being started with the skip-networking option you would see this behavior, but what I have in my my.cnf is

Code:
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address            = 127.0.0.1
key_buffer              = 16M
max_allowed_packet      = 16M
thread_stack            = 128K
a grep of the my.cnf shows that's the only entry that contains skip-networking. I also can't find any trace of it in etc/init.d/mysql

Can anyone shed some light as to what I'm doing wrong?
 
Old 03-28-2005, 08:12 PM   #2
auximini
Member
 
Registered: Dec 2003
Location: Calgary, AB
Distribution: Any!
Posts: 146

Rep: Reputation: 18
Just to be on the safe side, telnet to port 3306 on your mysql server. If you don't get an error, it's up and running and now it's a mysql problem rather than a network problem.

Make sure you've granted access to the user@host in mysql. For example:

Code:
grant all on database.* to 'root@hostname' identified by 'password'
Then try it again
 
Old 03-28-2005, 08:22 PM   #3
Jukas
Member
 
Registered: Mar 2005
Posts: 141

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by auximini
Just to be on the safe side, telnet to port 3306 on your mysql server. If you don't get an error, it's up and running and now it's a mysql problem rather than a network problem.

Make sure you've granted access to the user@host in mysql. For example:

Code:
grant all on database.* to 'root@hostname' identified by 'password'
Then try it again
When I telnet to port 3306 I see the same host denied message but it is referencing the mysql server. I checked my hosts.deny file and I don't have anything listed there. When I try and enter the syntax above I get the following

Code:
mysql> grant all on database.* to 'root@%' identified by 'xxxxx'
    -> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database.* to 'root@%' identified by 'xxxx'' at line 1
mysql>
I get the same error message regardless of if I put the ; at the end of the identified by ' ' or on a seperate line. I also tried downloading the mysql CC on the the linux box under gnome, and I get the same hostname denied message.
 
Old 03-28-2005, 08:25 PM   #4
auximini
Member
 
Registered: Dec 2003
Location: Calgary, AB
Distribution: Any!
Posts: 146

Rep: Reputation: 18
using database.* would literally mean that you have a database named database. try *.* maybe? I've never tried that one. Also, I think % goes outside the quotes or it takes it as a literal %.
 
Old 03-29-2005, 11:32 AM   #5
Jukas
Member
 
Registered: Mar 2005
Posts: 141

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by auximini
using database.* would literally mean that you have a database named database. try *.* maybe? I've never tried that one. Also, I think % goes outside the quotes or it takes it as a literal %.
Thanks for the info.. I was able to fix it using the following:

GRANT Select, Insert, Update ON *.* TO 'root'@'%' IDENTIFIED BY 'password';
 
Old 05-01-2010, 05:31 PM   #6
p_b_r
LQ Newbie
 
Registered: Mar 2010
Posts: 1

Rep: Reputation: 0
Lightbulb

I'm posting this as an aid to future readers of this thread. The problem with:

Code:
grant all on somedatabase.* to 'someuser@%' identified by 'theirpassword';
...is with the username being specified. 'grant' ends up creating a new user named someuser@% here, and giving THAT user the access rather than the user you thought you were granting access to.

You can see that by running:

Code:
select host,user from mysql.user;
You'll see an extra user there who you need to delete, using:

Code:
drop user 'someuser@%'@'%';
And then you can run the grant specifying the username properly:

Code:
grant all on somedatabase.* to 'someuser'@'%' identified by 'theirpassword';
(note the single-quotes around the at-sign) Following all of this, run:

Code:
flush privileges;
 
Old 05-01-2010, 11:50 PM   #7
alan99
Member
 
Registered: Mar 2010
Distribution: Debian
Posts: 180

Rep: Reputation: 31
If you want to open your mysql server to a network (hopefully your port 3306 will be protected by a firewall), you need to bind the server to your IP address (i.e. the address of your ethernet adapter) Your's is only bound to localhost (127.0.0.1)
 
Old 11-05-2011, 10:25 PM   #8
sakibsyl
LQ Newbie
 
Registered: Nov 2010
Posts: 3

Rep: Reputation: 2
Smile I have solved my issue

Here is what id did.
1. Login on MySQL server as root
2. Select the database using --USE Database name command;
3.GRANT ALL ON Login.* to 'root'@'Remote IP ADDRESS' IDENTIFIED BY 'PASSWORD';

That's all you have to do.

Last edited by sakibsyl; 11-05-2011 at 10:26 PM.
 
1 members found this post helpful.
  


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
Can't SSH to remote machine: Connection closed by remote host Avatar Linux - Networking 35 10-23-2017 12:21 AM
Mysql Remote Connection Problems harbringer Linux - Software 5 04-14-2005 02:42 PM
Remote Mysql Connection in PHP ElementNine Programming 2 05-03-2004 04:24 PM
Mysql Error: Lost Connection to Mysql during query ramnath Programming 5 11-18-2003 12:27 PM
Remote Connection to mysql server Graanco Linux - General 1 07-18-2003 11:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08: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