Connect to SQL with any old username ?
Posted by: marsheng (---.slingshot.co.nz)
Date: June 04, 2017 10:18AM

I'm new to PHP and the actual workings of Wamp. It seems that it does not matter what ever I enter for username and password, I always connect. If I'm running locally, do they not matter ?

<?php
$servername = "localhost";
$username = "Fred";
$password = "Blogs";
$dbname = "clubs_db";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}

$sql = "SELECT MemName FROM members_cams";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "MemName: " . $row["MemName"]. "<br>";
}
}
else {
echo "0 results";
}
$conn->close();
?>

Options: ReplyQuote
Re: Connect to SQL with any old username ?
Posted by: RiggsFolly (Moderator)
Date: June 04, 2017 04:42PM

Hi

Very odd. It should matter that you use a userid and password that

a) exist in the MySQ database
b) that the userid and password match
c) that the userid is allowed access to the database you connect to.

Are you sure you dont have another MySQL database running?

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Connect to SQL with any old username ?
Posted by: marsheng (---.slingshot.co.nz)
Date: June 04, 2017 11:56PM

I only have wamp running and if I change the database name, I get a error in the connection so it looks like part of it is working.

Options: ReplyQuote
Re: Connect to SQL with any old username ?
Posted by: marsheng (---.slingshot.co.nz)
Date: June 05, 2017 03:55AM

I have a Raspberry pi running on the home network. Its address is 10.0.0.6. If I use this address, the [password and username have to be correct to connect. Are there any settings in wamp to allow access without username and password ?

Thanks Wallace.

Options: ReplyQuote
Re: Connect to SQL with any old username ?
Posted by: marsheng (---.slingshot.co.nz)
Date: June 05, 2017 04:01AM

I think I may have found the problem. I can connect to phpmyadmin with any username !!! I may have messed this up after I forgot the root password and did a password reset.

Not sure how to fix this.



Edited 1 time(s). Last edit at 06/05/2017 04:33AM by marsheng.

Options: ReplyQuote
Re: Connect to SQL with any old username ?
Posted by: RiggsFolly (Moderator)
Date: June 05, 2017 10:04AM

Ahhhh

Now we are getting somewhere.

While doing whatever you did to reset passwords did you set `skip-grant-tables` in the my.ini?
If so, remove that line OR comment it out like this `;skip-grant-tables`

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote


Sorry, only registered users may post in this forum.