美文网首页
mac terminal mysql

mac terminal mysql

作者: 申申申申申 | 来源:发表于2017-05-13 14:17 被阅读109次
  1. 使用时需要找到mysql所在的bin目录
tianqingsedengyanyu:~ fengfeng$ /usr/local/mysql/bin/mysql -u root -p
Enter password: 
  1. alias
tianqingsedengyanyu:~ fengfeng$ vim ~/.bash_profile
# Add environment variable COCOS_CONSOLE_ROOT for cocos2d-x
export COCOS_CONSOLE_ROOT=/Applications/Cocos/Cocos2d-x/cocos2d-x-3.10/tools/cocos2d-console/bin
export PATH=$COCOS_CONSOLE_ROOT:$PATH
# Add environment variable COCOS_X_ROOT for cocos2d-x
export COCOS_X_ROOT=/Applications/Cocos/Cocos2d-x
export PATH=$COCOS_X_ROOT:$PATH
# Add environment variable COCOS_TEMPLATES_ROOT for cocos2d-x
export COCOS_TEMPLATES_ROOT=/Applications/Cocos/Cocos2d-x/cocos2d-x-3.10/templates
export PATH=$COCOS_TEMPLATES_ROOT:$PATH
alias mysql='/usr/local/mysql/bin/mysql';
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
:wq!

更改别名后 使用下面命令,使 ~/.bash_profile 生效

tianqingsedengyanyu:~ fengfeng$ source  ~/.bash_profile
tianqingsedengyanyu:~ fengfeng$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 64
Server version: 5.7.16 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, 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> 
  1. 退出mysql
mysql> quit
Bye
tianqingsedengyanyu:~ fengfeng$ 
  1. 开启、终止 mysql 服务
tianqingsedengyanyu:~ fengfeng$ sudo /usr/local/mysql/support-files/mysql.server start
Password:
Starting MySQL
. SUCCESS! 
tianqingsedengyanyu:~ fengfeng$
tianqingsedengyanyu:~ fengfeng$ sudo /usr/local/mysql/support-files/mysql.server stop
Shutting down MySQL
. SUCCESS! 
tianqingsedengyanyu:~ fengfeng$ 
  1. 重置密码
mysql> set password = password('123456');
  1. 选择数据库
mysql> use eshop;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> 
  1. 查看数据库中的表
mysql> show tables;
  1. 查看表字段名注释
mysql> desc eshop_points_order;
+----------------------+--------------+------+-----+---------+----------------+
| Field                | Type         | Null | Key | Default | Extra          |
+----------------------+--------------+------+-----+---------+----------------+
| point_orderid        | int(11)      | NO   | PRI | NULL    | auto_increment |
| point_ordersn        | varchar(20)  | NO   |     | NULL    |                |
| point_buyerid        | int(11)      | NO   |     | NULL    |                |
| point_buyername      | varchar(50)  | NO   |     | NULL    |                |
| point_buyeremail     | varchar(100) | NO   |     | NULL    |                |
| point_addtime        | int(11)      | NO   |     | NULL    |                |
| point_shippingtime   | int(11)      | YES  |     | NULL    |                |
| point_shippingcode   | varchar(50)  | YES  |     | NULL    |                |
| point_shipping_ecode | varchar(30)  | YES  |     | NULL    |                |
| point_finnshedtime   | int(11)      | YES  |     | NULL    |                |
| point_allpoint       | int(11)      | NO   |     | 0       |                |
| point_ordermessage   | varchar(300) | YES  |     | NULL    |                |
| point_orderstate     | int(11)      | NO   |     | 20      |                |
+----------------------+--------------+------+-----+---------+----------------+
13 rows in set (0.00 sec)
mysql> 

 不定期更新 不合适的地方 还请指点~ 感激不尽

相关文章

网友评论

      本文标题:mac terminal mysql

      本文链接:https://www.haomeiwen.com/subject/eydxxxtx.html