I am using XAMPP and windows 10. I have created a database and imported its contents froma database I created on a different server. Now when I try to access the new database via PHP I am unable to connect. I am using the same user name, and password that I used when I created the database on the other server. How should I set up the mysql login details?
the easiest way is going to be to use the PHPMyAdmin instance that XAMPP installed for you.
Databases do not carry user information; that is part of the server’s internal tables.
PHPMyAdmin has a User administration section.
The default user for XAMPP Mysql is root and no password. If you want to create additional users you will need to use the console or any of the many Mysql GUI apps available.
*and you should. Don’t use root for actual website queries!
“XAMPP is the most popular PHP development environment”
Being that XAMPP is a local dev environment, it isn’t going to make any difference, but outside of that, I would completely agree. Of course, there is nothing wrong with adding a matching login on the local dev.
* In the case that a particular user only has certain permissions in the DB Server itself, such as only SELECT permissions, you would want to replicate that in the local dev as well for testing.
OP, I would recommend you try Laragon. It is much better than XAMPP in several ways, one being that it automatically creates a host for you so you can run as http://myapp.test instead of localhost/myapp. I used XAMMP for many years before I discovered Laragon.