纯属一篇MySQL安装笔记,没太大技术含量
记录一下,在安装过程中进行的环境路径的设置
下载安装
官网地址:MySQL官网
进去后,按 DOWNOADS->Commnity->MySQL Community Server 就可以找到下载的位置。
image选择下载为dmg文件,一路确定就可以了
安装完成后,会提示默认密码,记得保存!
启动MySQL
安装成功后,在系统偏好中启动
系统偏好设置->MySQL->Start MySQL Server
设置启动别名
默认安装后,需要启动MySQL都要到安装路径下,默认路径为/usr/local/mysql/bin/mysql,设置别名是为了方便直接运行MySQL命令
alias 别名自定义命令
在配置文件中,设置别名(用的是on my zsh,配置文件为.zshrc)
alias mysql=/usr/local/mysql/bin/mysql
alias mysqladmin=/usr/local/mysql/bin/mysqladmin
立即生效修改
➜ ~ source .zshrc
查看所有命令别名
➜ ~ alias
在本次session中临时设置别名,重启会生效
➜ ~ alias 别名=原有名称
修改密码登陆
修改默认密码
➜ ~ mysqladmin -u root -p password
Enter password:默认密码
New password:新密码
Confirm new password:新密码
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
登陆
➜ ~ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.7.21 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
退出MySQL
mysql> quit
Bye
网友评论