【Linux】-- Mysql(1):简介和安装使用
2017-05-24 17:48
507 查看
系统环境
Ubuntu 14.04 64位版本简述
SQL
结构化查询语句(Strructured Query Language), 用于对数据库进行操作的语言,更详细的说,SQL 是一种数据库查询和程序设计语言,用于存取数据以及查询、更新和管理关系数据库系统,同时也是数据库脚本文件的扩展名MySQL
MySQL 是一个 DBMS(数据库管理系统),MySQL 是最流行的关系型数据库管理系统(关系数据库,是建立在关系数据库模型基础上的数据库,借助于集合代数等概念和方法来处理数据库中的数据)。MySQL 的安装
检查是否安装
pinsily@zhu ~$ sudo service mysql start mysql: unrecognized service
如果出现以上显示则没有安装
安装
# 更新软件库 pinsily@zhu ~$ sudo apt-get update # 安装 Mysql 服务端 pinsily@zhu ~$ sudo apt-get install mysql-server # 安装 Mysql 客户端,期间需要设置密码,这是登录 mysql 的密码,务必记住 pinsily@zhu ~$ sudo apt-get install mysql-client
验证安装是否成功
# 以下提示则安装成功 pinsily@zhu ~$ sudo netstat -tag | grep mysql tcp 0 0 localhost:mysql *:* LISTEN
初步使用
启动 Mysql
# 启动 Mysql 服务 pinsily@zhu ~$ sudo service mysql start …… # 使用 root 用户登录,接下来输入密码 pinsily@zhu ~$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 37 Server version: 5.5.55-0ubuntu0.14.04.1 (Ubuntu) Copyright (c) 2000, 2017, 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>
命令中的
-u表示 user ,
-p表示 password,空密码的 mysql 用户不用
-p选项
查看数据库
mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | +--------------------+ 3 rows in set (0.01 sec)
连接数据库 use database_name;
mysql> use mysql 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> show tables; +---------------------------------------+ | Tables_in_information_schema | +---------------------------------------+ | CHARACTER_SETS | | COLLATIONS | | COLLATION_CHARACTER_SET_APPLICABILITY | | COLUMNS | | COLUMN_PRIVILEGES | | ENGINES | | EVENTS | | FILES | | GLOBAL_STATUS | | GLOBAL_VARIABLES | | KEY_COLUMN_USAGE | | PARAMETERS |
退出
使用exit或
quit命令退出 mysql
相关文章推荐
- 在Linux下安装和使用MySQL
- 在Linux下安装和使用MySQL
- 在Linux下安装和使用MySQL
- 在Linux下安装和使用MySQL
- 在Linux下安装和使用MySQL
- 在Linux下安装和使用MySQL
- 在Linux下安装和使用Mysql
- 在Linux下安装和使用MySQL
- linux下mysql安装使用手册(目前最全)
- 在Linux下安装和使用MySQL
- 在Linux下安装和使用MySQL
- 在Linux下安装和使用MySQL
- 在Linux下使用MySQL简介
- 在Linux下安装和使用MySQL
- 在Linux下安装和使用MySQL
- 在Linux下安装和使用MySQL
- linux下mysql(rpm)安装使用手册
- 在Linux下使用MySQL简介
- 在Linux下安装和使用MySQL
- 在Linux下安装和使用MySQL