0

基本上,我无法使用 php 网页连接到 mysql 数据库。我使用像这样连接的向导在 C-panel 中创建了数据库

$db_host = "localhost"; //your host Database address

$db_username = "xxxx"; //your account username

$db_pass = "xxxxx"; //your account password

$db_name = "xxxxx"; //your database name

@mysql_connect("$db_host","$db_username","$db_pass") or die ("could not connect to     mysql");

@mysql_select_db("$db_name") or die ("no database");

但我的页面似乎所做的只是触发“无法连接到 mysql”我的页面确实安装了 wordpress,但我打算在我自己创建网站时摆脱它。我只是对为什么它无法连接感到困惑,因为在 Phpmyadmin(C 面板上的一个功能)中,它说数据库在 localhost 中。

4

1 回答 1

0

在 C-panel 中,您需要添加数据库用户并为其分配某些角色,然后才能连接到数据库。

于 2012-10-27T22:56:36.590 回答