Trying to use PHPMyAdmin to to access my Asterisk Database, I am getting the following error:
#1130 - Host ‘192.168.1.120’ is not allowed to connect to this MySQL server
I am sure it is a security issue with Linux, but how do I add my machine to the approved machinges to access the database?
sounds like a MySQL conf, permissions in MySQL are often specified to allow access to a specific user only from the local system. You would have to take off the local restriction (or allow access from the specific remote system to be more secure, I think you can do that in MySQL iirc
Philippe Lindheimer - FreePBX Project Lead
http//freepbx.org - IRC #freepbx
That’s right…so your MySql comment might look like:
GRANT ALL PRIVILEGES asterisk.* TO [email protected]'192.168.1.120';
OR you could allow any internal network client in like this:
GRANT ALL PRIVILEGES asterisk.* TO [email protected]'192.168.1.0/255.255.255.0';
Which would allow any client on your internal network to access the DB. But the best option from a security standpoint is definitely to define the network address of the client that you want to allow in. Actually the best option for security is to only allow the server access
Check out this article on the MySQL page for more:
Thanks for the help!
A couple more questions!
Is the "GRANT’ command an sql command, and if so how do I implement it? I tried finding it on the command line of linux using “find” and “locate” and it doesn’t show up any where in the Linux folders.
If it iis done as a Query, how do I do that in Linux.
It is a MySQL command. To connect to the mysql server type
> mysql -uroot -p
You could alternatively log in as your asterisk user as it should already have GRANT permissions on the asterisk DB for the local machine. Once logged in you will see a “mysql>” prompt where you can enter the above commands.
Hope that helps!
I tried the above and got the following error:
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
I am using the password that is in the AMPDBPASS in the amportal.conf file. Is that true.
If not, how do I find out what it is.
Also, the user name in amportal.conf (AMPDBUSER) is asteriskuser not root. Does it make any difference?
Thanks again for your help!
You really should know your MySQL root password…if it’s still at defaults (ie: blank) than try issuing this command to change the root password and try the above command again (obviously, change ‘new-password’ to something more secure):
mysqladmin -u root password 'new-password'
…if that doesn’t work, give the asteriskuser a shot:
> mysql -uasteriskuser -p
Although I’m not entirely certain that this account will have the GRANT permissions on the DB…it’s definitely worth a shot.
Let me know what happens!
Thank you again for your input. I can not get into MySQL even though I don’t know why. I re-edited the files to change the password again and everything is working ok with regard to accessing the mysql now.
Now trying to issue the command from above, I get the following error:
GRANT ALL PRIVILEGES asterisk.* TO [email protected]‘192.168.1.120’;
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 'asterisk.* to [email protected]‘192.168.1.120’ ’ at line 1
I think I am gettin close!
Ignore the above. I changed the syntax and added “ON” after “Privileges” and error went away.
I now get a different error!
To get into MYSQL successfully , my login was
mysql -uasteriskuser -p
I am obviously using “asteriskuser” and not root. The Trixbox directions suggest that asteriskuser is the default database user. Can I still use root. I have tried every password (even a blank one) and can’t get in using root. I am suspecting that root has more rights.
My new error when issuing the following command:
GRANT ALL PRIVILEGES ON asterisk.* TO [email protected]‘192.168.1.120’;
ERROR 1044 (42000): Access denied for user ‘asteriskuser’@‘localhost’ to database ‘asterisk’
I assume “asteriskuser” has all of the rights that it needs.
What is happening?
Unfortunately I don’t have any experience with Trixbox, if the directions say to use asteriskuser than I would have to assume that is the privileged user. Perhaps someone with more experience in Trixbox could lend a hand?
Thanks, I really appreciated your input from above, and it has helped me to at least make some progress.