View previous topic :: View next topic |
Author |
Message |
tommy_fila Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/7022964683fd891627b4c5.gif)
Joined: 19 Nov 2003 Posts: 450 Location: Phoenix, AZ
|
Posted: Tue Apr 05, 2005 3:46 pm Post subject: Connect to SQL database |
|
|
I'm getting the following error when I try to set the password for my SQL database:
Code: | /usr/bin/mysqladmin -u root -h laptop password 'pass'
/usr/bin/mysqladmin: connect to server at 'laptop' failed
error: 'Host 'laptop.localnetwork' is not allowed to connect to this MySQL server' |
This problem has been covered numerous times in other threads, but no one seems to have found a solution. When I try to set the password without using "-h laptop" everything works fines.
My questions is, what is the difference between using "-h laptop" and just leaving it out? I read that if you use "-h laptop" then you can establish remote connections to your database. What exactly does that mean? I only have ssh access to the server, so I definitely need remote access to my SQL database. What should I do? _________________ "What goes on in life, that goes for eternity." |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
msalerno Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/174712528041c87d66e1b63.gif)
Joined: 17 Dec 2002 Posts: 1338 Location: Sweating in South Florida
|
Posted: Tue Apr 05, 2005 3:50 pm Post subject: |
|
|
What address does laptop resolve to?
If it resolves to any address other than 127.0.0.1 then there is the problem.
By default mysql listens on the lo 127.0.0.1 adapter. So if laptop resolves to 192.168.3.15, then your command:
/usr/bin/mysqladmin -u root -h laptop password 'pass'
might was well be
/usr/bin/mysqladmin -u root -h 192.168.3.15 password 'pass'
And would cause an error since Mysql isn't listening on that IP. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
tomvollerthun Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/1354925728425282311fe7d.gif)
Joined: 19 Mar 2005 Posts: 316
|
Posted: Tue Apr 05, 2005 3:54 pm Post subject: |
|
|
If you include -h laptop you basically tell mysql that you try to access it from the host laptop (which you are not allowed to). If you don't have it in your commandline, mysql (correctly) assumes that you connect from localhost (which you are allowed to).
Mysql has excellent information on their websites. Search it for user setup and user permissions and you'll find plenty of information on how to solve this properly. _________________ Computer science is no more about computers than astronomy is about telescopes.
Dijsktra
---------------
Don't believe my "Guru" status! |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
tommy_fila Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/7022964683fd891627b4c5.gif)
Joined: 19 Nov 2003 Posts: 450 Location: Phoenix, AZ
|
Posted: Tue Apr 05, 2005 7:42 pm Post subject: |
|
|
Thanks for all the replies guys.
I understand what you're saying, but now I have another question. Why would you ever want a different host than "localhost". In other words, why would you ever want to include the "-h" flag in the command?
Like I said in the post above, I'm trying to set up SQL so I can use it with my webserver. I have remoted acces (ssh) to the server. In order for me to use SQL, do I even need to set the "-h" flag, or is it enough if I only allow "localhost" to connect?
Thanks again for helping. _________________ "What goes on in life, that goes for eternity." |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
msalerno Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/174712528041c87d66e1b63.gif)
Joined: 17 Dec 2002 Posts: 1338 Location: Sweating in South Florida
|
Posted: Tue Apr 05, 2005 8:42 pm Post subject: |
|
|
Quote: | Why would you ever want a different host than "localhost". |
For a remotly hosted Mysql server. My hosting company does not give me shell access, but they give me access to the sql server. This way I can manage my databases from my system.
Quote: | do I even need to set the "-h" flag |
No
tomvollerthun wrote: | If you include -h laptop you basically tell mysql that you try to access it from the host laptop (which you are not allowed to). If you don't have it in your commandline, mysql (correctly) assumes that you connect from localhost (which you are allowed to). |
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
tommy_fila Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/7022964683fd891627b4c5.gif)
Joined: 19 Nov 2003 Posts: 450 Location: Phoenix, AZ
|
Posted: Tue Apr 05, 2005 10:43 pm Post subject: |
|
|
One last question. I'm configuring SQL to work with my phpBB board. Is it dangerous to run SQL as root, and how do I find out the name of my database? Is there a default name? I just created the database following the installation instructions... _________________ "What goes on in life, that goes for eternity." |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
tommy_fila Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/7022964683fd891627b4c5.gif)
Joined: 19 Nov 2003 Posts: 450 Location: Phoenix, AZ
|
Posted: Tue Apr 05, 2005 11:38 pm Post subject: |
|
|
Ok, I just read that the SQL root user has nothing to do with the systemwide root user. So I guess there is no problem with that. However, I still can't figure out the name of my database!
Any help? _________________ "What goes on in life, that goes for eternity." |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
msalerno Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/174712528041c87d66e1b63.gif)
Joined: 17 Dec 2002 Posts: 1338 Location: Sweating in South Florida
|
Posted: Wed Apr 06, 2005 1:56 pm Post subject: |
|
|
To view a list of all databases:
# mysql -u root -p
mysql> show databases;
tommy_fila wrote: | However, I still can't figure out the name of my database! |
If the database was created with a sql script from phpBB, chances are all you have to do is read through the docs. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
tommy_fila Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/7022964683fd891627b4c5.gif)
Joined: 19 Nov 2003 Posts: 450 Location: Phoenix, AZ
|
Posted: Wed Apr 06, 2005 2:54 pm Post subject: |
|
|
I figured it out. Thank you! _________________ "What goes on in life, that goes for eternity." |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|