↓ 快轉到主要內容

忘記 Mysql ROOT 密碼的解決辦法

·174 字·1 分鐘
Y Cheung
作者
Y Cheung
Blogger, Programer & Traveler.
目錄

豬腦袋是記不住密碼的。

靠別人也是記不住密碼的。

環境
#

  • Ubuntu

操作步驟
#

修改MySQL配置
#

在 /etc/my.cnf 中的 [mysqld]段尾處加入以下語句:

1        skip-name-resolve
2        skip-grant-tables

重啟MYSQL:
#

1        service mysql restart

登錄MYSQL並修改密碼
#

1        mysql
2        USE mysql;
3        UPDATE user Password = password('your-password') WHERE User = 'root';
4        // or you can use:
5        // SET PASSWORD FOR 'root'@'localhost' = PASSWORD('your-password');
6        flush privileges;
7        quit

還原MySQL配置
#

修改MYSQL配置文件,刪除在前述步驟中添加的語句;

再次重啟MYSQL
#

相關文章

獲取最新文章並附特色圖片的代碼

·250 字·1 分鐘
幫朋友寫的,順便放在這裡mark一下好了。 以下代碼實現獲取最新10篇日誌及其100×100像素的特色圖片。 1<?php query_posts('posts_per_page=10'); if (have_posts()) : while (have_posts()) : the_post(); ?> 2 3<?php if (has_post_thumbnail()){the_post_thumbnail(array(100,100)); } ?> <?php the_title(); ?> 4 5<?php echo get_the_date(); ?> 6 7<?php endwhile; endif;?> COMMENTS (7) # 老武 · 2012-03-26T10:42:20+08:00

WordPress宕机一日

·616 字·2 分鐘
昨天突然无法访问我的blog了,还以为我又折腾什么出错了,却发现连服务器都进不去了。大件事啦! 联系了hugege(我在他那里租的主机),说是到国内的线路抽风喔。于是,我又定了定神,没事,等它抽完了就好了。果然,晚上的时候就恢复正常了,额,也不算太正常,时不时还是抽一下,不过,能访问就好了。(^U^)ノ~YO