您已经知道SQL用于访问与操作数据库,所以在开始使用SQL之前,首先需要安装数据库系统,如MySQL、SQL Server等。
本教程中,采用MySQL作为我们的数据库管理系统。
安装MySQL
MySQL是非常流行的开源数据库管理系统。使用很简单,您可以从这里免费下载安装
https://dev.mysql.com/downloads/mysql/
mariaDB
MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可 MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品。在存储引擎方面,使用XtraDB(英语:XtraDB)来代替MySQL的InnoDB。
MariaDB由MySQL的创始人Michael Widenius(英语:Michael Widenius)主导开发,他早前曾以10亿美元的价格,将自己创建的公司MySQL AB卖给了SUN,此后,随着SUN被甲骨文收购,MySQL的所有权也落入Oracle的手中,Oracle有将MySQL闭源的潜在风险,因此社区采用分支的方式来避开这个风险。
MariaDB推出后,大型互联网用户以及Linux发行商纷纷抛弃MySQL,转投MariaDB阵营。MariaDB是目前最受关注的MySQL数据库衍生版,也被视为开源数据库MySQL的替代品。
MariaDB名称来自Michael Widenius的女儿Maria的名字。
下载安装mariaDB
连接MySQL
MySQL安装完成后,在开始菜单找到MySQL xxx command Line Client
,打开后,输入密码登录数据库:
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.7.20-log MySQL Community Server (GPL)
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>
mariaDB类似方式,开始菜单找到命令行客户端,打开登录:
Enter password: ******
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 6
Server version: 10.1.17-MariaDB mariadb.org binary distribution
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
退出连接,执行quit
命令:
> quit