面向所有主流平台,安全、完善,操作复杂
面向所有主流平台,大型、安全、完善
免费、开源、体积小
1、实体
1、关系数据库的存储结构是二维表格
2、在每个二维表中
1、非关系数据库也被称作NoSQL (Not Only SQL)存储数据不以关系模型为依据,不需要固定的表格式
2、非关系型数据库的优点
一款深受欢迎的开源关系型数据库; Oracle旗下的产品,遵守GPL协议,可以免费使用与修改
特点
[root@localhost ~]# tar zxvf mysql-boost-5.7.20.tar.gz -C /opt/
[root@localhost ~]# cd /opt/mysql-5.7.20/
[root@localhost mysql-5.7.20]# useradd -s /sbin/nologin mysql
[root@localhost mysql-5.7.20]#yum -y install ncurses ncurses-devel bison cmake
[root@localhost mysql-5.7.20]#cmake \ //如果安装出错,可以写成一行,中间都要空格分隔
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/usr/local/mysql \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DWITH_BOOST=boost \
-DWITH_SYSTEMD=1
[root@localhost mysql-5.7.20]# make
[root@localhost mysql-5.7.20]# make install
[root@localhost mysql-5.7.20]# cd /usr/local/
[root@localhost local]# ll
drwxr-xr-x. 11 root root 151 8月 11 09:57 nginx
[root@localhost local]# chown -R mysql:mysql /usr/local/mysql/ //更改属主属组为mysql
[root@localhost local]# ll
drwxr-xr-x. 11 mysql mysql 197 8月 11 12:18 mysql
[root@localhost local]# cd /etc/
[root@localhost etc]# vim my.cnf
[client]
port=3306
default-character-set=utf8
socket=/usr/local/mysql/mysql.sock
[mysql]
port=3306
default-character-set=utf8
socket=/usr/local/mysql/mysql.sock
[mysqld]
user=mysql
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
port=3306
character_set_server=utf8
pid-file=/usr/local/mysql/mysqld.pid
socket=/usr/local/mysql/mysql.sock
server-id=1
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,PIPES_AS_CONCAT,ANSI_QUOTES
设置环境变量
[root@localhost etc]# vim /etc/profile
PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH
export PATH //声明为全局变量
[root@localhost etc]# source /etc/profile //加载环境变量
初始化数据库
[root@localhost etc]# cd /usr/local/mysql/
[root@localhost mysql]# ls
bin COPYING-test include man README share usr
COPYING docs lib mysql-test README-test support-files
[root@localhost mysql]# ls bin/
mysql_install_db
mysqld
[root@localhost mysql]# bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data //初始化数据库
2020-08-11T11:41:37.791663Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-08-11T11:41:38.155226Z 0 [Warning] InnoDB: New log files created, LSN=45790
2020-08-11T11:41:38.210661Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2020-08-11T11:41:38.269282Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 9dec1b5f-dbc7-11ea-ab28-000c29cd9a36.
2020-08-11T11:41:38.269993Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-08-11T11:41:38.271838Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
[root@localhost mysql]# cp /usr/lib/systemd/system/mysqld.service /usr/lib/systemd/system
[root@localhost mysql]# systemctl start mysqld
[root@localhost mysql]# netstat -antp | grep mysqld
tcp6 0 0 :::3306 :::* LISTEN 95058/mysqld
[root@localhost mysql]# systemctl enable mysqld //设置开机自启
Created symlink from /etc/systemd/system/multi-user.target.wants/mysqld.service to /usr/lib/systemd/system/mysqld.service.
[root@localhost mysql]# mysqladmin -u root -p password "abc123" //设置mysql密码
Enter password: //空密码所以按空格
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
[root@localhost mysql]# mysql -u root -p
Enter password: //输入刚刚设置的密码abc123
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
mysql> quit
Bye