我有一个新的域名&托管,但我无法连接到新的数据库。
我尝试过的:
'db'=>array(
'connectionString' => 'mysql:host=ascodcurro.com.mysql;dbname=ascodcurro_com',
'emulatePrepare' => true,
'username' => 'ascodcurro_com',
'password' => 'xxxx',
'charset' => 'utf8',
), 如果我一如既往地尝试localhost,它会工作得很好。来自主机的用户信息:
MySQL
server: ascodcurro.com.mysql
DB: ascodcurro_com
user: ascodcurro_com
pw: *****
PhpMyAdmin
PhpMyAdmin: https://dbadmin.one.com/
user: ascodcurro_com
pw: ******发布于 2013-04-25 01:24:26
在最初启动和使用Yii时,我遇到的第一个问题是连接到数据库。
我收到了一个非常奇怪的错误,并且我无法连接到我的XAMPP堆栈上的Mac OSX Mountain Lion上的数据库。经过无数次的搜索,我终于找到了一种可行的方法。这是唯一的方式,我可以连接到我的数据库为Yii。
‘'db' => array( 'connectionString’=> 'mysql:host=localhost;dbname=ascodcurro_com','emulatePrepare‘=> true,'username’=>‘用户名’,'password‘=> 'pass','charset’=> 'utf8','tablePrefix'=>'','enableProfiling'=>true,'enableParamLogging'=>true,),
但是,如果您在此之后仍然无法连接到数据库,因为我无法连接到我的数据库,请尝试以下方法:创建一个新的php文件并键入:
<?php phpinfo() ?>查看该页面,找出'mysql‘的位置,找出其中的'MYSQL_SOCKET’并记下该位置。
记下位置之后,尝试将其作为'db‘连接字符串(例如,对我来说,位置是"/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock"):
'connectionString' => 'mysql:unix_socket=/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock;dbname=practice',其余的作为您使用的基本参数。然后再次尝试连接。
希望这能将你连接到你的数据库。
致以敬意,
发布于 2013-04-24 16:27:02
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=basename',
'emulatePrepare' => true,
'username' => 'username',
'password' => 'pass',
'charset' => 'utf8',
'tablePrefix'=>'',
'enableProfiling'=>true,
'enableParamLogging'=>true,
),这是我的配置。你收到什么错误了吗?
https://stackoverflow.com/questions/16186879
复制相似问题