OS: CentOS 5.5 64bit

yum install mysql mysql-server mysql-devel

 

裝完後 

chgrp -R mysql /var/lib/mysql 
chmod -R 770 /var/lib/mysql

然後打開服務

service mysqld start

 

改密碼

/usr/bin/mysqladmin -u root password 'new-password' 
/usr/bin/mysqladmin -u root -h hostname password 'new-password' 


reset root 密碼

/etc/init.d/mysqld stop

mysqld_safe --skip-grant-tables &

mysql -u root -p

mysql> use mysql;
mysql> update user set password=PASSWORD("新root密碼") where User='root';
mysql> flush privileges;
mysql> quit

/etc/init.d/mysqld stop

/etc/init.d/mysqld start

新增mysql.user host

mysql> CREATE USER 'root'@'192.168.1.1' IDENTIFIED BY '設定此host的password';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.1' WITH GRANT OPTION;

新增mysql.user host '%' : 允許所有內外部連線

mysql> CREATE USER 'root'@'%' IDENTIFIED BY '設定此host的password';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;

刪除host

drop user 'root'@'localhost'; 

登入root 加 host

mysql -u root -h hostname -p

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 caramels 的頭像
    caramels

    Samuel

    caramels 發表在 痞客邦 留言(0) 人氣()