Connect Cpanel MySQL issue (Not local host)
-
-
- Posts: 40
- Joined: Fri Jan 21, 2022 12:44 pm
Connect Cpanel MySQL issue (Not local host)
Hi, i recently using forms and login tools to connect with MySQL, but i unable to connect it to my server. In the Cpanel i have created a database and mysql account, maybe i fill the wrong database name, server or username.
Did anyone can teach me what and how to fill it ?
Really appreciate
Did anyone can teach me what and how to fill it ?
Really appreciate
Professional Web Design and Development Service - Odeysoft
https://odeysoft.com
https://odeysoft.com
Re: Connect Cpanel MySQL issue (Not local host)
Are you sure the settings are correct?
What is the error?
What is the error?
- BaconFries
-
- Posts: 5933
- Joined: Thu Aug 16, 2007 7:32 pm
Re: Connect Cpanel MySQL issue (Not local host)
As each host is different only yours will be able to confirm that the settings and the username and password are correct so please contact them to confirm these are what should be used.i have created a database and mysql account, maybe i fill the wrong database name, server or username.
-
-
- Posts: 40
- Joined: Fri Jan 21, 2022 12:44 pm
Re: Connect Cpanel MySQL issue (Not local host)
It said
--- Database that i fill
--- MyPhp main page
--- Username
--- MySQL table
The password is 100% correct as i have ask my hosing provider
Correct me if i fill wrong. Thanks and really appreciate
Here are the image providedFailed to select database
Access denied for user 'phillip_login-test'@'localhost' to database 'phillip_login-test'
The password is 100% correct as i have ask my hosing provider
Correct me if i fill wrong. Thanks and really appreciate
Last edited by Phillip911 on Tue Feb 22, 2022 3:28 pm, edited 1 time in total.
Professional Web Design and Development Service - Odeysoft
https://odeysoft.com
https://odeysoft.com
Re: Connect Cpanel MySQL issue (Not local host)
It looks ok as far as I can tell.
What is the error?
What is the error?
-
-
- Posts: 40
- Joined: Fri Jan 21, 2022 12:44 pm
Re: Connect Cpanel MySQL issue (Not local host)
When i uploaded and try signup an account, it said
Failed to select database
Access denied for user 'phillip_login-test'@'localhost' to database 'phillip_login-test'
Any advice ?
Failed to select database
Access denied for user 'phillip_login-test'@'localhost' to database 'phillip_login-test'
Failed to select database
Access denied for user 'phillip_login-test'@'localhost' to database 'phillip_login-test'
Any advice ?
Professional Web Design and Development Service - Odeysoft
https://odeysoft.com
https://odeysoft.com
Re: Connect Cpanel MySQL issue (Not local host)
This can only be a configuration issue.
You will need to contact your web host about this
You will need to contact your web host about this
Re: Connect Cpanel MySQL issue (Not local host)
Try using the address instead of localhost...Phillip911 wrote: Tue Feb 22, 2022 3:29 pm When i uploaded and try signup an account, it said
Failed to select database
Access denied for user 'phillip_login-test'@'localhost' to database 'phillip_login-test'
Failed to select database
Access denied for user 'phillip_login-test'@'localhost' to database 'phillip_login-test'
Any advice ?
127.0.0.1:3306
James,
https://quikflixx.net
https://quikflixx.net
Re: Connect Cpanel MySQL issue (Not local host)
Hello Phillip,
I don't know, but if I'm right, the error that you have say "Failed to select database" ??
if you want to connect to a database, 4 parameters are required:
1) DB Host -> in most cases "localhost". If your application is not placed on the same server where your application is hosted, you should enter here the IP address of your MYSQL Server. (Ex. 123.45.55.33)
2) DB name -> the name of the database
3) DB user -> the user that is authorized to use the database
4) DB password -> clear:-)
One more think: if the IP address of the server where your application is located and the IP Address of your MYSQL server is not the same, you MUST advise your MYSQL server to accept connections from other IP addresses. You can allow ALL IP addresses to connect to you MYSQL server or just a few.
For security reason I will suggest to accept connections just from the required IP address.
Regards, Adrian
I don't know, but if I'm right, the error that you have say "Failed to select database" ??
if you want to connect to a database, 4 parameters are required:
1) DB Host -> in most cases "localhost". If your application is not placed on the same server where your application is hosted, you should enter here the IP address of your MYSQL Server. (Ex. 123.45.55.33)
2) DB name -> the name of the database
3) DB user -> the user that is authorized to use the database
4) DB password -> clear:-)
One more think: if the IP address of the server where your application is located and the IP Address of your MYSQL server is not the same, you MUST advise your MYSQL server to accept connections from other IP addresses. You can allow ALL IP addresses to connect to you MYSQL server or just a few.
For security reason I will suggest to accept connections just from the required IP address.
Regards, Adrian
Re: Connect Cpanel MySQL issue (Not local host)
Thanks Adrian for the more detailed suggestions from what I gave. I was on my way out the door and didn't have time.Adrian wrote: Wed Feb 23, 2022 8:46 am Hello Phillip,
I don't know, but if I'm right, the error that you have say "Failed to select database" ??
if you want to connect to a database, 4 parameters are required:
1) DB Host -> in most cases "localhost". If your application is not placed on the same server where your application is hosted, you should enter here the IP address of your MYSQL Server. (Ex. 123.45.55.33)
2) DB name -> the name of the database
3) DB user -> the user that is authorized to use the database
4) DB password -> clear:-)
One more think: if the IP address of the server where your application is located and the IP Address of your MYSQL server is not the same, you MUST advise your MYSQL server to accept connections from other IP addresses. You can allow ALL IP addresses to connect to you MYSQL server or just a few.
For security reason I will suggest to accept connections just from the required IP address.
Regards, Adrian
Jim
James,
https://quikflixx.net
https://quikflixx.net
Re: Connect Cpanel MySQL issue (Not local host)
Hello quikflixx,
sorry. reply to the wrong user
Regards, Adrian
sorry. reply to the wrong user

Regards, Adrian
Re: Connect Cpanel MySQL issue (Not local host)
Hello Phillip,
I don't know, but if I'm right, the error that you have say "Failed to select database" ??
if you want to connect to a database, 4 parameters are required:
1) DB Host -> in most cases "localhost". If your application is not placed on the same server where your application is hosted, you should enter here the IP address of your MYSQL Server. (Ex. 123.45.55.33)
2) DB name -> the name of the database
3) DB user -> the user that is authorized to use the database
4) DB password -> clear:-)
One more think: if the IP address of the server where your application is located and the IP Address of your MYSQL server is not the same, you MUST advise your MYSQL server to accept connections from other IP addresses. You can allow ALL IP addresses to connect to you MYSQL server or just a few.
For security reason I will suggest to accept connections just from the required IP address.
Regards, Adrian
I don't know, but if I'm right, the error that you have say "Failed to select database" ??
if you want to connect to a database, 4 parameters are required:
1) DB Host -> in most cases "localhost". If your application is not placed on the same server where your application is hosted, you should enter here the IP address of your MYSQL Server. (Ex. 123.45.55.33)
2) DB name -> the name of the database
3) DB user -> the user that is authorized to use the database
4) DB password -> clear:-)
One more think: if the IP address of the server where your application is located and the IP Address of your MYSQL server is not the same, you MUST advise your MYSQL server to accept connections from other IP addresses. You can allow ALL IP addresses to connect to you MYSQL server or just a few.
For security reason I will suggest to accept connections just from the required IP address.
Regards, Adrian
-
-
- Posts: 40
- Joined: Fri Jan 21, 2022 12:44 pm
Re: Connect Cpanel MySQL issue (Not local host)
I have try, but still can'tquikflixx wrote: Wed Feb 23, 2022 7:28 amTry using the address instead of localhost...Phillip911 wrote: Tue Feb 22, 2022 3:29 pm When i uploaded and try signup an account, it said
Failed to select database
Access denied for user 'phillip_login-test'@'localhost' to database 'phillip_login-test'
Failed to select database
Access denied for user 'phillip_login-test'@'localhost' to database 'phillip_login-test'
Any advice ?
127.0.0.1:3306
Professional Web Design and Development Service - Odeysoft
https://odeysoft.com
https://odeysoft.com
Re: Connect Cpanel MySQL issue (Not local host)
Hello Phillip,
can you connect to your MYSQL Server in Phpmyadmin?
Every host has his own access to the mysql server and this is phpmyadmin.
With this error message, I think this is the best way to beginn finding the error.
can you connect to your MYSQL Server in Phpmyadmin?
Every host has his own access to the mysql server and this is phpmyadmin.
With this error message, I think this is the best way to beginn finding the error.
-
-
- Posts: 40
- Joined: Fri Jan 21, 2022 12:44 pm
Re: Connect Cpanel MySQL issue (Not local host)
Yes, i able to connect MySQL with my Php admin. When i create a database at MySQL, Php my admin will update. Current error is still "Fail to connect database"Adrian wrote: Thu Feb 24, 2022 7:58 am Hello Phillip,
can you connect to your MYSQL Server in Phpmyadmin?
Every host has his own access to the mysql server and this is phpmyadmin.
With this error message, I think this is the best way to beginn finding the error.


Professional Web Design and Development Service - Odeysoft
https://odeysoft.com
https://odeysoft.com
Re: Connect Cpanel MySQL issue (Not local host)
Hello Phillip,
----Fail to connect database mean that something is wrong.
If Phpmyadmin works and your application don't work AND all the settings are correct, than please take into consideration this point:
---------------------
One more think: if the IP address of the server where your application is located and the IP Address of your MYSQL server is not the same, you MUST advise your MYSQL server to accept connections from other IP addresses. You can allow ALL IP addresses to connect to you MYSQL server or just a few.
For security reason I will suggest to accept connections just from the required IP address.
--------------------
----Fail to connect database mean that something is wrong.
If Phpmyadmin works and your application don't work AND all the settings are correct, than please take into consideration this point:
---------------------
One more think: if the IP address of the server where your application is located and the IP Address of your MYSQL server is not the same, you MUST advise your MYSQL server to accept connections from other IP addresses. You can allow ALL IP addresses to connect to you MYSQL server or just a few.
For security reason I will suggest to accept connections just from the required IP address.
--------------------
-
-
- Posts: 40
- Joined: Fri Jan 21, 2022 12:44 pm
Re: Connect Cpanel MySQL issue (Not local host)
I have ask my host provider about the MySQL IP, they said the IP of the MySQL is same as the file manager. So i think it not the issue of IP, i still try and errorAdrian wrote: Thu Feb 24, 2022 12:42 pm Hello Phillip,
----Fail to connect database mean that something is wrong.
If Phpmyadmin works and your application don't work AND all the settings are correct, than please take into consideration this point:
---------------------
One more think: if the IP address of the server where your application is located and the IP Address of your MYSQL server is not the same, you MUST advise your MYSQL server to accept connections from other IP addresses. You can allow ALL IP addresses to connect to you MYSQL server or just a few.
For security reason I will suggest to accept connections just from the required IP address.
--------------------
Professional Web Design and Development Service - Odeysoft
https://odeysoft.com
https://odeysoft.com
Re: Connect Cpanel MySQL issue (Not local host)
Hello Phillip,
I have another Idea
I put you here a php script, fill it correctly and upload him to your server.
After that, call the php file in the browser (your_Domain/path/file.php)and look what's happen.
If connection is established, you application has a problem.
If your connection fail, the database connection parameters are false.
<?php
# Fill our vars and run on cli
# $ php -f db-connect-test.php
$dbname = 'db_name';
$dbuser = 'db_user';
$dbpass = 'db_passwd';
$dbhost = 'localhost or IP';
$link = mysqli_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
mysqli_select_db($link, $dbname) or die("Could not open the db '$dbname'");
$test_query = "SHOW TABLES FROM $dbname";
$result = mysqli_query($link, $test_query);
$tblCnt = 0;
while($tbl = mysqli_fetch_array($result)) {
$tblCnt++;
#echo $tbl[0]."<br />\n";
}
if (!$tblCnt) {
echo "There are no tables<br />\n";
} else {
echo "There are $tblCnt tables<br />\n";
}
?>
I have another Idea

I put you here a php script, fill it correctly and upload him to your server.
After that, call the php file in the browser (your_Domain/path/file.php)and look what's happen.
If connection is established, you application has a problem.
If your connection fail, the database connection parameters are false.
<?php
# Fill our vars and run on cli
# $ php -f db-connect-test.php
$dbname = 'db_name';
$dbuser = 'db_user';
$dbpass = 'db_passwd';
$dbhost = 'localhost or IP';
$link = mysqli_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
mysqli_select_db($link, $dbname) or die("Could not open the db '$dbname'");
$test_query = "SHOW TABLES FROM $dbname";
$result = mysqli_query($link, $test_query);
$tblCnt = 0;
while($tbl = mysqli_fetch_array($result)) {
$tblCnt++;
#echo $tbl[0]."<br />\n";
}
if (!$tblCnt) {
echo "There are no tables<br />\n";
} else {
echo "There are $tblCnt tables<br />\n";
}
?>