2
我正在使用Vagrant在Windows中啓動VirtualBox VM。我做的:試圖使用vagrant將表加載到我的數據庫中
$ vagrant ssh
要連接到虛擬機。然後我做$ mysql
連接到我的數據庫。然後我可以看到我創建的數據庫。但是當我去到我的服務器我看到這個錯誤:
The table "doe_user" for active record class "User" cannot be found in the database.
我知道那是因爲數據庫是空的,犯規存在表用戶。這就是爲什麼我用這個嘗試添加表到數據庫:
load all tables in the doe_db: http://***.***.**.**/install.php;
當我運行它,我得到:
mysql> load all tables in the doe_db: http://***.***.**.**/install.php;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'all t
ables in the doe_db: http://***.***.**.**/install.php' at line 1,
當我使用show databases
然後我選擇了正確的數據庫,然後要求以顯示錶返回空集。
當我去我的http://***.***.**.**/install.php
我得到:
Internal Server Error Undefined index: log An internal error occurred while the Web server was processing your request. Please contact the webmaster to report this problem. Thank you.
這裏是我的數據庫代碼:
$config_database = array(
'components' => array(
'db' => array(
'connectionString' => 'mysql:host=localhost;dbname=doe_db',
'emulatePrepare' => true,
'username' => 'root',
'password' => 'root',
'charset' => 'utf8',
'enableProfiling' => true, //http://www.yiiframework.com/doc/guide/1.1/en/topics.logging
'enableParamLogging' => true,
),
),
);
現在,當我訪問:http://***.***.**.**/index.php
我得到的錯誤:
The table "doe_user" for active record class "User" cannot be found in
the database.
然而,當我改變我的DATABSE代碼:
$config_database = array(
'components' => array(
'db' => array(
'connectionString' => 'mysql:host=localhost;dbname=doe_db',
'emulatePrepare' => true,
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'enableProfiling' => true, //http://www.yiiframework.com/doc/guide/1.1/en/topics.logging
'enableParamLogging' => true,
),
),
);
當我訪問:http://***.***.**.**/index.php
我得到:
CDbConnection failed to open the DB connection: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO)
我的本地主機,當我想訪問phpMyAdmin的,我沒有任何密碼爲我的根用戶。
事情是最後一次,我沒有必要使用硫線我建議,但我用我以前使用的線,它的工作,我不知道什麼改變。順便說一句,當我運行你的命令時,它告訴我沒有選擇數據庫。 – David
在'tablename'之前追加'database'名稱,比如'databaseName.doe_db' – Arpit
我的數據庫被稱爲doe_db,所以命令應該是:LOAD DATA INFILE'http://***.***.** 。**/install.php'INTO TABLE doe_db.doe_db; ???? – David