1.链接:
mysql -h localhost -u root -p
然后输入密码就能登录mysql
2.建立数据库:
CREATEDATABASE
tutorial;
显示数据库
show databases;
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| GoodByeDealer |
| iWebShop |
| invo |
| laravel5 |
| mysql |
| performance_schema |
| prestashop |
| test |
| tutorial |
+--------------------+
10 rows in set (0.00 sec)
mysql>
3.选中数据库:
use tutorial;
4.建表:
CREATETABLE
users;
查看表:
mysql> show tables
-> ;
+--------------------+
| Tables_in_tutorial |
+--------------------+
| users |
+--------------------+
1 row in set (0.00 sec)
5.查询信息:
select
* from users;
mysql> select * from users;
+----+------+-----------+
| id | name | email |
+----+------+-----------+
| 1 | cy | cy@qq.com |
+----+------+-----------+
1 row in set (0.00 sec)
6.或者使用本地sql文件建表:
mysql> use tutorial;
Database changed
mysql> source /var/www/html/tutorial/schemas/tutorial.sql;
7.现实数据库XXX所拥有的表:
mysql> show tables;
+-------------------------+
| Tables_in_GoodByeDealer |
+-------------------------+
| dict_band |
| dict_car_item |
| dict_car_item_value |
| dict_car_style |
| dict_country |
| dict_order_service |
| dict_pic_pos |
| dict_state |
| tb_address |
| tb_car_detail |
| tb_car_pic |
| tb_car_simple |
| tb_order |
| tb_pay_detail |
| tb_user |
+-------------------------+
15 rows in set (0.00 sec)
Ubuntu15.10 Kylin安装MySQL 5.7.9:http://www.linuxdiyf.com/linux/16137.html
在Ubuntu上安装Mysql并远程连接:http://www.linuxdiyf.com/linux/15568.html
Ubuntu15.04的MySQL数据库允许Toad远程连接:http://www.linuxdiyf.com/linux/12995.html
Linux下查看MySQL的安装路径:http://www.linuxdiyf.com/linux/14760.html
ubuntu15.04手动安装MySQL5.6.27数据库:http://www.linuxdiyf.com/linux/14699.html