FreeBSD MySQL忘记密码

今天使用時出現

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (61)

其實是忘記密碼啦XDD

#背景執行mysql安全模式

mysqld_safe -u root –skip-grant-tables &

#登入mysql(不用密碼)

mysql -u root -p

>use mysql

>UPDATE user SET password=password(‘這裡輸入你的密碼’) where user=’root’;

>FLUSH PRIVILEGES;

>exit

/usr/local/etc/rc.d/mysql-server restart

评论

此博客中的热门博文

FreeBSD安装Pure-FTPd及user manager for PureFTPd

debian lighttpd php ssl

解决nginx出现File not found的问题