当前位置:Gxlcms > 数据库问题 > mac下面安装mysql

mac下面安装mysql

时间:2021-07-01 10:21:17 帮助过:22人阅读

./mysql -uroot -p

提示输入密码,此时输入拷贝下来的临时密码

(如果这里一直报错,那么用

./mysqld_safe --skip-grant-tables --skip-networking

参考网址http://blog.csdn.net/ku360517703/article/details/49684809

这方法在linux下屡试不爽,可是在mac下似乎没用,依然让我输入密码。官方说法是If you lose this password, please consult the section How to Reset the Root Password in the MySQL reference manual,不过我还没去看,以后忘了密码再说吧)

进入mysql之后

mysql> set password for root@localhost = password(‘newpassword‘); 

之后exit,再用新密码进入一下试试

如果修改成功,那么进行下一步

 

配置环境变量(这步可以略过,不过那样子每次mysql都要进入/usr/local/mysql/bin/,很麻烦)

1.打开终端,输入: cd ~

会进入~文件夹

2.然后输入:touch .bash_profile

回车执行后,

2.再输入:open -e .bash_profile

会在TextEdit中打开这个文件(如果以前没有配置过环境变量,那么这应该是一个空白文档)。如果有内容,请在结束符前输入,如果没有内容,请直接输入如下语句:

export PATH=${PATH}:/usr/local/mysql/bin

然后,保存,退出TextEdit(一定是退出),关闭终端并退出。在终端输入mysql -uroot -p看看。

 

删除mysql

有时因为某些原因,mysql需要删除掉,比如某个配置文件搞错了无法恢复什么的

删除如下,很麻烦

技术分享
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
sudo vim /etc/hostconfig  (and removed the line MYSQLCOM=-YES-)
sudo rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /var/db/receipts/com.mysql.*
技术分享

删除完了重启电脑,就可以重新装mysql了。

mac下面安装mysql

标签:please   dmg   比较   lib   成功   tco   rm -rf   copy   res   

人气教程排行