friends-of-reactphp / mysql

Async MySQL database client for ReactPHP.
MIT License
334 stars 66 forks source link

Unable to connect to mysql #130

Closed Nedum84 closed 3 years ago

Nedum84 commented 3 years ago

I have xamp already installed on my system(Mac). From htdocs, I can connect to my database but when i try to connect to the same mysql database using reactphp, It's not working. What I did.

$user = "root"; $pass = ""; $db = "test";

$url = "$user:$pass@localhost/$db";

$factory->createConnection($url)->then( function (ConnectionInterface $connection) { echo "connected"; }, function (Exception $e) { echo "Error: $er \n"; } );

What am i getting wrong please

clue commented 3 years ago

@Nedum84 Thanks for reporting, this should not have happened!

[…] It's not working.

Can you be more elaborate how you know "it's not working"? Are you seeing any error messages or anything?

Perhaps consider running one of the included examples, first with unaltered, incorrect credentials, then with correct ones. These examples are known to work and should give you a way to confirm expected operation.

A common problem when integrating this into custom code is lack of imports (use statements). If the above doesn't work, can you post a full gist of your code so that we can reproduce this locally?

Nedum84 commented 3 years ago

I created a new user and grant all privileges to it from this blog ( https://www.dev2qa.com/how-to-connect-to-mysql-server-after-install-xampp-on-mac-os/). It's working now. Thank you!