Warning: include(/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php): failed to open stream: No such file or directory in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24

Warning: include(/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php): failed to open stream: No such file or directory in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24

Warning: include(): Failed opening '/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php' for inclusion (include_path='.:/opt/cpanel/ea-php70/root/usr/share/pear') in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24
mysql忘記root password – unethost無限空間虛擬主機 技術分享部落格

mysql忘記root password

遇到這種不幸的情況,最簡單的方式,當然是使用WHM的功能,就可以簡單地重新設定。

然而,有時候,因為成本的因素,我們把cpanel/WHM的成本省下來的時候,就得用比較複雜的技巧來處理這個問題:

1  service mysql stop

2 修改 /etc/init.d/mysql
找到 mysqld_safe 這一行,加上 –skip-grant-tables

3 service mysql start

4  現在可以不用密碼登入了。
mysql  -u root
use mysql;
update user set password=password(‘yournewpasswordhere’) where user=’root’;
flush privileges;
exit;

5 service mysql restart