Xampp Access Denied phpmyadmin not connecting to MySQL
I read a lot of similar questions but nowhere did I find a definitive answer. Also my issue is different from those because until I shut down my system literally an hour back everything was working fine. So I'm posting my issue again in a separate question.
I'm running Xampp on Linux(Ubuntu 14.04) and while everything was working fine until an hour back right after I shut it down it suddenly starts throwing this error. I have not changed a single line of code in any file or changed any permissions or run any unknown command in Linux whatsoever :
Connection failed: SQLSTATE[HY000] [1049] Unknown database 'user_list'
Notice: Undefined variable: connect in /opt/lampp/htdocs/Project1_July2015/verify_blacklisted.php on line 15
Fatal error: Call to a member function prepare() on null in /opt/lampp/htdocs/Project1_July2015/verify_blacklisted.php on line 15
I have tested PDO connections using the variable 'connect' that connects to my database 'user_list' which DOES exist. It DOES retrieve data correctly. When I try to connect to localhost/phpmyadmin
MySQL said:
Cannot connect: invalid settings.
Connection for controluser as defined in your configuration failed.
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.
The username hasn't been set. It's "root" and password hasn't been set. I've been working with the same setting without changing any ownership or any other details in the installation of Xampp. I have no clue as to why this is happening. Anyone with any experience in this area that can help me solve these issues?
Edit : On further testing, I can connect to my other website on localhost that is stored similar to this one in my htdocs folder so it is definitely a problem only related to phpmyadmin not connecting to my databases because the website that works doesn't involve connection to any databases on it's home page at least. Just mentioned it in case that detail helps in solving the issue.
My connection code is as follows and it worked right until an hour back :
<?php
$server_name = "127.0.0.1";
$server_username = "root";
$server_password = "";
$db_name=$_SESSION["db_name"];
//echo "<br>"."Attempting connection to database " . $db_name . "<br>";
try {
$connect = new PDO("mysql:host=$server_name;dbname=$db_name", $server_username, $server_password);
$connect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
//echo "<br>"."Connected successfully to database " . $db_name . "<br>";
} catch(PDOException $e) {
echo "<br>" . "Connection failed: " . $e->getMessage() . "<br>";
}
//#3
?>
Edit 2 : Like I said the code is fine. I haven't changed a single line of it and it worked perfectly before as well. My main issue here is that phpmyadmin itself cannot connect to the databases. Refer the screenshot below for details. I think that is the root cause of all the other issues :
php mysql linux pdo xampp
add a comment |
I read a lot of similar questions but nowhere did I find a definitive answer. Also my issue is different from those because until I shut down my system literally an hour back everything was working fine. So I'm posting my issue again in a separate question.
I'm running Xampp on Linux(Ubuntu 14.04) and while everything was working fine until an hour back right after I shut it down it suddenly starts throwing this error. I have not changed a single line of code in any file or changed any permissions or run any unknown command in Linux whatsoever :
Connection failed: SQLSTATE[HY000] [1049] Unknown database 'user_list'
Notice: Undefined variable: connect in /opt/lampp/htdocs/Project1_July2015/verify_blacklisted.php on line 15
Fatal error: Call to a member function prepare() on null in /opt/lampp/htdocs/Project1_July2015/verify_blacklisted.php on line 15
I have tested PDO connections using the variable 'connect' that connects to my database 'user_list' which DOES exist. It DOES retrieve data correctly. When I try to connect to localhost/phpmyadmin
MySQL said:
Cannot connect: invalid settings.
Connection for controluser as defined in your configuration failed.
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.
The username hasn't been set. It's "root" and password hasn't been set. I've been working with the same setting without changing any ownership or any other details in the installation of Xampp. I have no clue as to why this is happening. Anyone with any experience in this area that can help me solve these issues?
Edit : On further testing, I can connect to my other website on localhost that is stored similar to this one in my htdocs folder so it is definitely a problem only related to phpmyadmin not connecting to my databases because the website that works doesn't involve connection to any databases on it's home page at least. Just mentioned it in case that detail helps in solving the issue.
My connection code is as follows and it worked right until an hour back :
<?php
$server_name = "127.0.0.1";
$server_username = "root";
$server_password = "";
$db_name=$_SESSION["db_name"];
//echo "<br>"."Attempting connection to database " . $db_name . "<br>";
try {
$connect = new PDO("mysql:host=$server_name;dbname=$db_name", $server_username, $server_password);
$connect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
//echo "<br>"."Connected successfully to database " . $db_name . "<br>";
} catch(PDOException $e) {
echo "<br>" . "Connection failed: " . $e->getMessage() . "<br>";
}
//#3
?>
Edit 2 : Like I said the code is fine. I haven't changed a single line of it and it worked perfectly before as well. My main issue here is that phpmyadmin itself cannot connect to the databases. Refer the screenshot below for details. I think that is the root cause of all the other issues :
php mysql linux pdo xampp
show your connection file code.
– Mayank Vadiya
Nov 6 '15 at 12:53
trydie("debug");
to find out where the code fails
– BRoebie
Nov 6 '15 at 13:21
I know where the code fails. The issue lies with access to database denied for phpmyadmin itself so naturally the '$connect' isn't able to connect to the database in the first place which leads to the other two errors as well.
– Swapneel Mehta
Nov 6 '15 at 14:02
Is$cfg['Servers'][$i]['auth_type']
in yourconfig.inc.php
set to cookie or config? And what about$cfg['Servers'][$i]['AllowNoPassword']
– Nate Stone
Nov 6 '15 at 17:03
I cannot access localhost/security/xamppsecurity.php also here's what the file says :$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
– Swapneel Mehta
Nov 6 '15 at 17:11
add a comment |
I read a lot of similar questions but nowhere did I find a definitive answer. Also my issue is different from those because until I shut down my system literally an hour back everything was working fine. So I'm posting my issue again in a separate question.
I'm running Xampp on Linux(Ubuntu 14.04) and while everything was working fine until an hour back right after I shut it down it suddenly starts throwing this error. I have not changed a single line of code in any file or changed any permissions or run any unknown command in Linux whatsoever :
Connection failed: SQLSTATE[HY000] [1049] Unknown database 'user_list'
Notice: Undefined variable: connect in /opt/lampp/htdocs/Project1_July2015/verify_blacklisted.php on line 15
Fatal error: Call to a member function prepare() on null in /opt/lampp/htdocs/Project1_July2015/verify_blacklisted.php on line 15
I have tested PDO connections using the variable 'connect' that connects to my database 'user_list' which DOES exist. It DOES retrieve data correctly. When I try to connect to localhost/phpmyadmin
MySQL said:
Cannot connect: invalid settings.
Connection for controluser as defined in your configuration failed.
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.
The username hasn't been set. It's "root" and password hasn't been set. I've been working with the same setting without changing any ownership or any other details in the installation of Xampp. I have no clue as to why this is happening. Anyone with any experience in this area that can help me solve these issues?
Edit : On further testing, I can connect to my other website on localhost that is stored similar to this one in my htdocs folder so it is definitely a problem only related to phpmyadmin not connecting to my databases because the website that works doesn't involve connection to any databases on it's home page at least. Just mentioned it in case that detail helps in solving the issue.
My connection code is as follows and it worked right until an hour back :
<?php
$server_name = "127.0.0.1";
$server_username = "root";
$server_password = "";
$db_name=$_SESSION["db_name"];
//echo "<br>"."Attempting connection to database " . $db_name . "<br>";
try {
$connect = new PDO("mysql:host=$server_name;dbname=$db_name", $server_username, $server_password);
$connect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
//echo "<br>"."Connected successfully to database " . $db_name . "<br>";
} catch(PDOException $e) {
echo "<br>" . "Connection failed: " . $e->getMessage() . "<br>";
}
//#3
?>
Edit 2 : Like I said the code is fine. I haven't changed a single line of it and it worked perfectly before as well. My main issue here is that phpmyadmin itself cannot connect to the databases. Refer the screenshot below for details. I think that is the root cause of all the other issues :
php mysql linux pdo xampp
I read a lot of similar questions but nowhere did I find a definitive answer. Also my issue is different from those because until I shut down my system literally an hour back everything was working fine. So I'm posting my issue again in a separate question.
I'm running Xampp on Linux(Ubuntu 14.04) and while everything was working fine until an hour back right after I shut it down it suddenly starts throwing this error. I have not changed a single line of code in any file or changed any permissions or run any unknown command in Linux whatsoever :
Connection failed: SQLSTATE[HY000] [1049] Unknown database 'user_list'
Notice: Undefined variable: connect in /opt/lampp/htdocs/Project1_July2015/verify_blacklisted.php on line 15
Fatal error: Call to a member function prepare() on null in /opt/lampp/htdocs/Project1_July2015/verify_blacklisted.php on line 15
I have tested PDO connections using the variable 'connect' that connects to my database 'user_list' which DOES exist. It DOES retrieve data correctly. When I try to connect to localhost/phpmyadmin
MySQL said:
Cannot connect: invalid settings.
Connection for controluser as defined in your configuration failed.
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.
The username hasn't been set. It's "root" and password hasn't been set. I've been working with the same setting without changing any ownership or any other details in the installation of Xampp. I have no clue as to why this is happening. Anyone with any experience in this area that can help me solve these issues?
Edit : On further testing, I can connect to my other website on localhost that is stored similar to this one in my htdocs folder so it is definitely a problem only related to phpmyadmin not connecting to my databases because the website that works doesn't involve connection to any databases on it's home page at least. Just mentioned it in case that detail helps in solving the issue.
My connection code is as follows and it worked right until an hour back :
<?php
$server_name = "127.0.0.1";
$server_username = "root";
$server_password = "";
$db_name=$_SESSION["db_name"];
//echo "<br>"."Attempting connection to database " . $db_name . "<br>";
try {
$connect = new PDO("mysql:host=$server_name;dbname=$db_name", $server_username, $server_password);
$connect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
//echo "<br>"."Connected successfully to database " . $db_name . "<br>";
} catch(PDOException $e) {
echo "<br>" . "Connection failed: " . $e->getMessage() . "<br>";
}
//#3
?>
Edit 2 : Like I said the code is fine. I haven't changed a single line of it and it worked perfectly before as well. My main issue here is that phpmyadmin itself cannot connect to the databases. Refer the screenshot below for details. I think that is the root cause of all the other issues :
php mysql linux pdo xampp
php mysql linux pdo xampp
edited Nov 6 '15 at 19:22
Gerald Schneider
14.1k84567
14.1k84567
asked Nov 6 '15 at 12:52
Swapneel Mehta
23210
23210
show your connection file code.
– Mayank Vadiya
Nov 6 '15 at 12:53
trydie("debug");
to find out where the code fails
– BRoebie
Nov 6 '15 at 13:21
I know where the code fails. The issue lies with access to database denied for phpmyadmin itself so naturally the '$connect' isn't able to connect to the database in the first place which leads to the other two errors as well.
– Swapneel Mehta
Nov 6 '15 at 14:02
Is$cfg['Servers'][$i]['auth_type']
in yourconfig.inc.php
set to cookie or config? And what about$cfg['Servers'][$i]['AllowNoPassword']
– Nate Stone
Nov 6 '15 at 17:03
I cannot access localhost/security/xamppsecurity.php also here's what the file says :$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
– Swapneel Mehta
Nov 6 '15 at 17:11
add a comment |
show your connection file code.
– Mayank Vadiya
Nov 6 '15 at 12:53
trydie("debug");
to find out where the code fails
– BRoebie
Nov 6 '15 at 13:21
I know where the code fails. The issue lies with access to database denied for phpmyadmin itself so naturally the '$connect' isn't able to connect to the database in the first place which leads to the other two errors as well.
– Swapneel Mehta
Nov 6 '15 at 14:02
Is$cfg['Servers'][$i]['auth_type']
in yourconfig.inc.php
set to cookie or config? And what about$cfg['Servers'][$i]['AllowNoPassword']
– Nate Stone
Nov 6 '15 at 17:03
I cannot access localhost/security/xamppsecurity.php also here's what the file says :$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
– Swapneel Mehta
Nov 6 '15 at 17:11
show your connection file code.
– Mayank Vadiya
Nov 6 '15 at 12:53
show your connection file code.
– Mayank Vadiya
Nov 6 '15 at 12:53
try
die("debug");
to find out where the code fails– BRoebie
Nov 6 '15 at 13:21
try
die("debug");
to find out where the code fails– BRoebie
Nov 6 '15 at 13:21
I know where the code fails. The issue lies with access to database denied for phpmyadmin itself so naturally the '$connect' isn't able to connect to the database in the first place which leads to the other two errors as well.
– Swapneel Mehta
Nov 6 '15 at 14:02
I know where the code fails. The issue lies with access to database denied for phpmyadmin itself so naturally the '$connect' isn't able to connect to the database in the first place which leads to the other two errors as well.
– Swapneel Mehta
Nov 6 '15 at 14:02
Is
$cfg['Servers'][$i]['auth_type']
in your config.inc.php
set to cookie or config? And what about $cfg['Servers'][$i]['AllowNoPassword']
– Nate Stone
Nov 6 '15 at 17:03
Is
$cfg['Servers'][$i]['auth_type']
in your config.inc.php
set to cookie or config? And what about $cfg['Servers'][$i]['AllowNoPassword']
– Nate Stone
Nov 6 '15 at 17:03
I cannot access localhost/security/xamppsecurity.php also here's what the file says :
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
– Swapneel Mehta
Nov 6 '15 at 17:11
I cannot access localhost/security/xamppsecurity.php also here's what the file says :
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
– Swapneel Mehta
Nov 6 '15 at 17:11
add a comment |
1 Answer
1
active
oldest
votes
So turns out the issue is a double installation of mysql within xampp as well as separately and handling which version is currently running.
This is what helped me figure it out
https://apple.stackexchange.com/questions/69955/how-to-stop-xampp-mysql-server
And this is a manual method I figured out later if it helps :
Installing xampp but phpmyadmin doesn't connect
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f33567249%2fxampp-access-denied-phpmyadmin-not-connecting-to-mysql%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
So turns out the issue is a double installation of mysql within xampp as well as separately and handling which version is currently running.
This is what helped me figure it out
https://apple.stackexchange.com/questions/69955/how-to-stop-xampp-mysql-server
And this is a manual method I figured out later if it helps :
Installing xampp but phpmyadmin doesn't connect
add a comment |
So turns out the issue is a double installation of mysql within xampp as well as separately and handling which version is currently running.
This is what helped me figure it out
https://apple.stackexchange.com/questions/69955/how-to-stop-xampp-mysql-server
And this is a manual method I figured out later if it helps :
Installing xampp but phpmyadmin doesn't connect
add a comment |
So turns out the issue is a double installation of mysql within xampp as well as separately and handling which version is currently running.
This is what helped me figure it out
https://apple.stackexchange.com/questions/69955/how-to-stop-xampp-mysql-server
And this is a manual method I figured out later if it helps :
Installing xampp but phpmyadmin doesn't connect
So turns out the issue is a double installation of mysql within xampp as well as separately and handling which version is currently running.
This is what helped me figure it out
https://apple.stackexchange.com/questions/69955/how-to-stop-xampp-mysql-server
And this is a manual method I figured out later if it helps :
Installing xampp but phpmyadmin doesn't connect
edited May 23 '17 at 12:02
Community♦
11
11
answered Nov 6 '15 at 18:43
Swapneel Mehta
23210
23210
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f33567249%2fxampp-access-denied-phpmyadmin-not-connecting-to-mysql%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
show your connection file code.
– Mayank Vadiya
Nov 6 '15 at 12:53
try
die("debug");
to find out where the code fails– BRoebie
Nov 6 '15 at 13:21
I know where the code fails. The issue lies with access to database denied for phpmyadmin itself so naturally the '$connect' isn't able to connect to the database in the first place which leads to the other two errors as well.
– Swapneel Mehta
Nov 6 '15 at 14:02
Is
$cfg['Servers'][$i]['auth_type']
in yourconfig.inc.php
set to cookie or config? And what about$cfg['Servers'][$i]['AllowNoPassword']
– Nate Stone
Nov 6 '15 at 17:03
I cannot access localhost/security/xamppsecurity.php also here's what the file says :
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
– Swapneel Mehta
Nov 6 '15 at 17:11