Codeigniter如何知道mysql服务器所在的位置?

时间:2014-08-16 19:00:37

标签: codeigniter

我知道这是一个非常新手的问题。所以假设我们安装了一个wamp服务器,并下载了codeigniter。 codeigniter是否通过phpinfo()页面上显示的环境变量路径找到mysql应用程序?如果可能的话,你能告诉我在codeigniter应用程序中哪里可以看到这个配置。 database.php文件似乎没有mysql路径。

2 个答案:

答案 0 :(得分:2)

您必须在application/config/database.php中定义mysql凭据,因此codeigniter可以连接到您的数据库。

要连接不需要路径,您必须提供主机,用户名和密码。

在你的情况下:

host: localhost
username: root
password: your default root password

请在此处阅读:https://ellislab.com/codeigniter/user-guide/database/configuration.html

答案 1 :(得分:0)

In general, MySQL server is to install as a Windows Service (Daemon on linux), it can be controlled from the command line, or with the graphical services utility.

PHP通过使用TCP/IP连接到MySQL来与MySQL交互。所以不必要,我们必须提供 像hostname, port(default 3306), username ,password etc这样的凭据,以便与它连接。可以找到更多详细信息here