Mac安装mysql遇到的坑

使用XMPP前安装了mysql,小白遇到好多坑,不要见怪

mysql官网下载,选择Community中扩展名为dmg的文件

安装完成后要记住密码,重要的事情只说一遍,对了,安装时也没有偏好设置和自启动,私以为是一个pkg里都包括了

在终端修改.bash_profile文件,设置一些别名以便使用

命令行输入 sudo vi ~/.bash_profile
原始文件内容,不知道有何作用,也不敢删除,先注释掉
#[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
#[[ -s "$HOME/.rvm/scripts/rvm" ]] && sou rce "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
添加内容,主要是设置别名,简化操作
# mysql
alias mysql='/usr/local/mysql/bin/mysql'
alias mysqladmin='/usr/local/mysql/bin/mysqladmin'
#ls
alias ls='ls -G'
 

登录数据库

mysql -u root -p
回车输入密码,这里就要输入之前记住的密码了,如果忘了别怪我之前没有提醒
 
显示当前表 
show databases;

好吧,怎么跟网上说的不一样。。

显示如下错误
You must reset your password using ALTER USER statement before executing this statement.
 
 
不能使用那就先修改密码吧,数据库语句不是很熟悉,猜测半天不如Google,某度伤我千百遍,还是翻一个吧
http://m.blog.chinaunix.net/uid-20785090-id-5162305.html
看了这篇文章的讲解,使用如下命令
mysqladmin -u root -p password
 
输入当前密码与新密码
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
加密保障安全
 
这时再show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.01 sec)
 
退出数据库exit;
Bye

你装好了吗?

posted on 2016-04-14 11:48  sea_star3  阅读(2047)  评论(0编辑  收藏  举报

导航