/opt/lampp/lampp stop mysql #停止mysql服務(wù)器
/opt/lampp/sbin/mysqld --skip-grant-tables #使用--skip-grant-tables參數(shù)來(lái)啟動(dòng)mysqld
/opt/lampp/bin/mysql -u root? #重新開(kāi)啟一個(gè)終端
use mysql;
update user set password=password("123456") where user="root"; #修改mysql密碼
flush privileges; #刷新權(quán)限表(必須要這一步)
quit;
/opt/lampp/lampp start mysql #重開(kāi)數(shù)據(jù)庫(kù)
此時(shí)還沒(méi)完,還得做以下操作
vim /opt/lampp/phpmyadmin/config.inc.php #修改文件,將其中的server密碼改為你設(shè)置的密碼就ok咯。
關(guān)于xampp在php代碼連接數(shù)據(jù)庫(kù)時(shí)所使用的函數(shù)是
mysqli_connect("主機(jī)","username","password")
mysqli_select_db(連接標(biāo)識(shí)符,"打開(kāi)數(shù)據(jù)庫(kù)");
@和or die 隱藏錯(cuò)誤和條件顯示
mysql_connect好像不能在xampp下使用,還是因?yàn)閜hp7版本的問(wèn)題,好像是php版本的問(wèn)題。。。