BR
asked on
creating a mysql table for shared ip
Dear Expert,
I have a cloud server that I host 5 web sites. I use cpanel and whm.
I have Centos operating system on my server. I created a database using Cpanel for one of my website.
I am trying to create a mysql table for the same website but when I use my ip addres for the connection string it can not connect it.
I have 5 domains 1 shared ip. I use below code to connect.
mysql_connect("my-shared-i paddress", "username", "password") or die(mysql_error());
mysql_select_db("mydatabas e") or die(mysql_error());
The error message is:
Warning: mysql_connect() [function.mysql-connect]: Host 'www.tavsiyevar.net' is not allowed to connect to this MySQL server in /home/alaramlz/public_html /test/CREA TE_iletisi m.php on line 11
Host 'www.tavsiyevar.net' is not allowed to connect to this MySQL server
I have a cloud server that I host 5 web sites. I use cpanel and whm.
I have Centos operating system on my server. I created a database using Cpanel for one of my website.
I am trying to create a mysql table for the same website but when I use my ip addres for the connection string it can not connect it.
I have 5 domains 1 shared ip. I use below code to connect.
mysql_connect("my-shared-i
mysql_select_db("mydatabas
The error message is:
Warning: mysql_connect() [function.mysql-connect]: Host 'www.tavsiyevar.net' is not allowed to connect to this MySQL server in /home/alaramlz/public_html
Host 'www.tavsiyevar.net' is not allowed to connect to this MySQL server
Is the username you're trying to use of the format cpanelusername_databaseuse rname ? You need to be using the cPanel-generated database username and need to have granted it access to your database - it's not your FTP user details you need there.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You have to grant permissions to the database user on that IP, try GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'www.domain.tld.' IDENTIFIED BY 'password';
or change www.domain.tld to the IP Address.
or change www.domain.tld to the IP Address.
ASKER
Dear RedLondon I did what you said and it didn't work.
the error message I recieve now is
Access denied for user 'alaramlz_ala'@'localhost' to database 'alaramlz_iletisim'
the error message I recieve now is
Access denied for user 'alaramlz_ala'@'localhost'
ASKER
Dear adrian_brooks,
I have done what you said but I still can not access the database.
the error message is now " Access denied for user 'alaramlz_ala'@'localhost' to database 'alaramlz_iletisim' "
I have done what you said but I still can not access the database.
the error message is now " Access denied for user 'alaramlz_ala'@'localhost'
ASKER
Dear AhmetGeek,
when I tried what you said, the error message is
#1044 - Access denied for user 'alaramlz'@'localhost' to database 'alaramlz_iletisim'
when I tried what you said, the error message is
#1044 - Access denied for user 'alaramlz'@'localhost' to database 'alaramlz_iletisim'
Click "MySQL Databases" in cPanel
Does alaramlz_ala appear in the Users column for the database alaramlz_iletisim?
If not, use the "Add User To Database" section below to add it
If so, check that wherever you tell your script to use the alaramlz_ala username, that you have specified the correct password.
If you're not sure what the correct password is, and alaramlz_ala isn't used anywhere else, you could just use cPanel to delete the user, then recreate it with a password you make a note of, then add it to the alaramlz_iletisim database again. If it is used elsewhere, you could just add a new user, give it permission to access the database using the same cPanel page, then set your script to use that new username and password.
Does alaramlz_ala appear in the Users column for the database alaramlz_iletisim?
If not, use the "Add User To Database" section below to add it
If so, check that wherever you tell your script to use the alaramlz_ala username, that you have specified the correct password.
If you're not sure what the correct password is, and alaramlz_ala isn't used anywhere else, you could just use cPanel to delete the user, then recreate it with a password you make a note of, then add it to the alaramlz_iletisim database again. If it is used elsewhere, you could just add a new user, give it permission to access the database using the same cPanel page, then set your script to use that new username and password.
Did you do a 'FLUSH PRIVILEGES'?
Try this.
GRANT ALL PRIVILEGES ON database_name.*TO 'user_name'@'IPADDRESS'
IDENTIFIED BY PASSWORD 'some_password'
WITH GRANT OPTION;
FLUSH PRIVILEGES;
I don't think it's a good idea to do a with grant Orion for any user other than root and especially when doing a grant all on *.*
Sorry, stupid cell phone auto correct bit my comment.
adrian_brooks Yeeep I changed it :D
To do that, in cPanel, click the Remote MySQL icon in the MySQL box, alongside the phpMyAdmin and MySQL Databases icon
If you don't see that icon, you may have to ask your server admin to do it for you (or if you have root access, you can give yourself access to Remote MySQL in the feature list)