简体   繁体   中英

Msql on linux address for mysqli connection

im new to linux and LAMP.

I have some problems to connect to my db.

Im using this code to connect to my db:

$mysqli2 = new mysqli("DB_ADDRESS", "user name", "password", "db name);

My problem is that i dont know what is the DNS/IP address to get connection to my db.

Should i use the simple address like www.xxxx.com?

Thank you for helping.

most probably just localhost . At least when you installed it locally. Otherwise, ask your system administrator

Edit: if you try to connect from another machine, you could go to http://www.whatismyip.com/ and try to use your ip-address as the hostname. Or like you said just the canonical domain. PHP will try to connect to the default mysql port. So if you have the "standard" installation that could work (if there is no fancy firewall in front of it). If that doesn't help, you should ask our friends at serverfault to help you with a correct configuration of the mysql server.

localhost (or if you want ip 127.0.0.1 )

If the database is installed in your local machine.

Talk to the guy who installed the database, or check with your hosting provider what database location is.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM