I am trying to setup a MySQL server that can be accessed by anyone on our internet network.
I can connect, via PHP, to the server using localhost, but not with my IP as hostname:
Warning: mysqli::mysqli() [mysqli.mysqli]: (28000/1045): Access denied for user 'user'#'user.corp.companyname.com' (using password: YES) in /Library/WebServer/Documents/doc.php on line 38
I've setup the same MySQL user using the hosts localhost, %, and *, but MySQL still doesn't seem to accept unknown hosts.
Update
Well, I give up: other machines on the network seem to have no problem making the MySQL connection, so it's just my local machine that refuses to authenticate when using my IP as the host.
Related
I recently began a new internship where we use the Laravel PHP framework. When trying to connect to the company's MySQL server, I can connect using the given credentials using a program such as MySQL Workbench because my ipv4 address is whitelisted. When using Laravel, it is using my hostname in the connection string, leading to a no access error and I am not sure how to change that. Does anyone know how to fix this?
SQLSTATE[HY000] [1045] Access denied for user 'xxxx'#'ipxx-xx-xx-xxx.ri.ri.cox.net' (using password: YES)
I had the same issue, my mistake was incorrect username defined for local development vs remote connection, after correcting it, mysql connection picks the ip instead of my hostname. Also the following configuration fix the issue too. original answer here
DATABASE_URL=mysql://username:password#db_host:3306/db_name
Add this to your env variables
I am trying to upload a website i created a few months ago. when I run the website using my computer as the server it works as desired. Using XAMPP
However when I Upload it I am getting an the error:
Could not connect to MySQL: Access denied for user 'root'#'91.223.9.100' (using password: NO)
Can anyone help me with the origin of this error. the web pages not using the a sql database look ok.
This is the first time I have tried this so I am sure it is a very basic error on my behalf.
I used filezilla to transfer the files across, I changed localhost to the FTP Hostname in the connect.php. then I tried changing it to the server IP.
I developed a project in PHP and converted it to project.exe using ZZEE PhpExe, It work fine on one PC where the WAMP is installed.
I connected another PC to the main Server using LAN and share the project.exe that was complied. I was able to open the project on the other PC, but it can't connect to MySql. by show this error
Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'localhost' (10061) in/www/inc/connect.php on line 13
I tried to use Firefox to check and it work without Error or Warning by using browsers. I went to change my connect.php server name to the LAN IP. E.g
$hostname = "localhost"; to $hostname = "192.168.1.3";
After the changes I Re-Compile the project, then another warning:
Warning: mysql_connect(): Host 'DESKTOP-VLU1NVA' is not allowed to connect to this MySQL server in C:\xampp\htdocs\clinicx\inc\connect.php on line 13
Please can someone tell me what to do.
You need to grant the remote PC access to the MySQL-server. Check out the GRANT command for MySQL: http://dev.mysql.com/doc/refman/5.7/en/grant.html
A very insecure way to do this is:
GRANT ALL ON *.* to '<a username>'#'192.168.1.%';
Don't use this for production, make sure to grant access to only what is needed and add a password.
I have recently started exploring free hosting sites where they provide free mysql and php.
I have created a database and trying to connect to the database from php script. But while running the php. I am getting following error :
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'a1696486_test '#'localhost' (using password: YES) in /home/a1696486/public_html/myphp/test1.php on line 2
Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'a1696486'#'localhost' (using password: NO) in /home/a1696486/public_html/myphp/test1.php on line 3
Any idea whats the problem ?
Regards,
Shankar
I have this issue on our dedicated servers, and the solution for me is to provide the fully qualified domain name rather than 'localhost'. For exmaple, my connection is:
mysqli_connect('dedi81.jnb1.host-h.net', 'user', 'pass', 'db');
Where even though localhost is the same as dedi81.jnb1.host-h.net (MySQL server and web server on one machine) I - for some reason - cannot use 'localhost'.
Another issue may be that on the hosting company you're with, they have not granted to you the correct permissions, or that there is indeed an error with the username and / or password.
You can also try and substitute 'localhost' with the IP address of the MySQL machine.
Kind regards,
Simon
I have a system with a globally open mysql connection to the local server. In one of my files I am opening an additional connection to a remote machine.
Wieldly instead of trying to connect to that machine, I get an access denied message from my ISP (it seems to be trying to connect to the database on that machine).
I am trying to connect using:
$cust_conn = mysql_connect($host,'root','##password##');
I have tried subdomain.domain.com:3306, subdomain.domain.com and ip:3306 as the value for $host.
The wierd this is the response i get:
Warning: mysql_connect(): Access denied for user 'root'#'my.isp.com' (using password: YES) in /var/www/html/report/module/sql_view.php on line 19 Error: Could not connect to database:
Any ideas why this would happen? It seems like for some reason my script is attempting to connect to my ISPs server, instead of the one passed in $host.
The host given in the error message is the host it's trying to connect from, not to.
that hostname in the error (my.isp.com) is your client's host...remote root access is often disabled, or perhaps the pass/host combo is wrong
to add the creds:
http://dev.mysql.com/doc/refman/5.1/en/adding-users.html