数据
表
数据库
关系型数据库特点
非关系型数据库统特点
第一阵营:5.0-5.1阵营,可说是早期产品的延续
第二阵营:5.4-5.7阵营,更好地整合了MySQL AB公司、社区、第三方公司开的存储引擎,提高了性能
第三阵营:6.0-7.1阵营,就是MySQL Cluster版本,为适应新时代集群对数据库的需求而开发
MySQL下载网址:https://www.mysql.com/downloads
[root@localhost ~]# yum -y install ncurses ncurses-devel bison cmake
[root@localhost ~]# yum install gcc gcc-c++ -y
[root@localhost ~]# useradd -s /sbin/nologin mysql
[root@localhost ~]# tar zxvf boost_1_59_0.tar.gz -C /opt
[root@localhost ~]# tar zxvf mysql-5.7.17.tar.gz -C /opt/
[root@localhost ~]# cd /opt/mysql-5.7.17/
[root@localhost mysql-5.7.17]# 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=/opt/boost_1_59_0/ \
-DWITH_SYSTEMD=1
[root@localhost mysql-5.7.17]# make && make install
[root@localhost mysql-5.7.17]# chown -R mysql:mysql /usr/local/mysql/
[root@localhost mysql-5.7.17]# vim /etc/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 mysql-5.7.17]# echo 'PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH' >> /etc/profile ##将MySQL写到本地环境配置中
[root@localhost mysql-5.7.17]# echo 'export PATH' >> /etc/profile
##设置全局环境配置
[root@localhost mysql-5.7.17]# source /etc/profile ##重新加载
[root@localhost mysql-5.7.17]# cd /usr/local/mysql/
[root@localhost mysql]# bin/mysqld \
--initialize-insecure \
--user=mysql \
--basedir=/usr/local/mysql \
--datadir=/usr/local/mysql/data
[root@localhost mysql]# cp /usr/local/mysql/usr/lib/systemd/system/mysqld.service /usr/lib/systemd/system/
[root@localhost mysql]# systemctl enable mysqld ###开机自启
[root@localhost mysql]# systemctl start mysqld.service ###启动服务
[root@localhost mysql]# netstat -natp | grep 3306
tcp6 0 0 :::3306 :::* LISTEN 2711/mysqld
[root@localhost mysql]# mysqladmin -u root -p password
Enter password: ##空格
New password: ##新密码
Confirm new password: ##确认密码
[root@localhost ~]# mysql -u root -p
Enter password: ##进入数据库,密码为之前设定的abc23
mysql>