重置mysql密碼的方法有很多,官網也提供了很方便的快捷操作辦法,可參考資料 resetting permissions 。本文重置密碼的具體步驟如下:
一、停止mysql(如果處於執行狀態)
#service mysqld stop輸出shutting down mysql. [ ok ]
關於 #service mysqld stop 命令,可參考 centos 6.5 平台離線編譯安裝 mysql5.6.22。
二、啟動mysql_safe,如此以來便可不用密碼登入mysql
# mysqld_safe --skip-grant-tables &輸出類似starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[
6025]: started
三、登入mysql
# mysql -u root輸出welcome to the mysql monitor. commands end with ; or \g.
your mysql connection
id is 1 to server version: 4.1.15-debian_1-log
type
'help;
' or '\h'
for help. type '
\c' to clear
the buffer.
mysql>
四、設定新密碼
mysql>use mysql;mysql> update user set password=password("
new-root-password
") where user='
root';
mysql>flush privileges;
mysql> quit
五、停止mysql
# /etc/init.d/mysql stop輸出stopping mysql database server: mysqld
stopping server from pid
file /var/run/mysqld/mysqld.pid
mysqld_safe[
6186
]: ended
[1]+ done mysqld_safe --skip-grant-tables
六、啟動mysql並測試新密碼是否正確
# /etc/init.d/mysql start# mysql -u root -p
參考位址
centOS下解除安裝samba
1 首先檢查samba服務包,輸入命令 rpm qa grep samba,會出現下面兩到三個包 samba common 2.2.7a 7.9.0.i386 伺服器和客戶端均需要的檔案 samba 2.2.7a 7.9.0.i386 伺服器端檔案 samba client 2.27a 7.9.0....
centos下刪除軟體
要知道安裝了哪些元件,通過命令 rpm qa grep qt root lala download rpm qa grep qt ibus qt 1.3.0 2.el6.i686 qt 4.6.2 26.el6 4.i686 qt devel 4.6.2 26.el6 4.i686 qt x11 4...
CentOS下安裝linux kernel原始碼
1.centos下安裝linux kernel的原始碼 以root使用者進行以下操作 yum install rpm build yum install redhat rpm config lynx rpm ivh kernel 2.6.32 71.el6.src.rpm 3.執行rpmbuild命...