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 7 Pro 32bit) (Wampserver 3.0.6 32bit)
<Apache 2.4.23/2.2.31> <PHP 7.1.2/7.0.16/5.6.28/5.5.38/5.4.45/5.3.29> <MySQL 5.7.10/5.6.17/5.5.28>
<MariaDB 10.1.21> <phpMyAdmin4.6.5.2> <MySQL Workbench 6.3.6.511>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin -- WAMPServer alternate Repo
-?-?-?- Backup your MySQL databases regularly Here is How dont regret it later! Yes even when developing -?-?-?-

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 7 Pro 32bit) (Wampserver 3.0.6 32bit)
<Apache 2.4.23/2.2.31> <PHP 7.1.2/7.0.16/5.6.28/5.5.38/5.4.45/5.3.29> <MySQL 5.7.10/5.6.17/5.5.28>
<MariaDB 10.1.21> <phpMyAdmin4.6.5.2> <MySQL Workbench 6.3.6.511>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin -- WAMPServer alternate Repo
-?-?-?- Backup your MySQL databases regularly Here is How dont regret it later! Yes even when developing -?-?-?-

Options: ReplyQuote


Sorry, only registered users may post in this forum.