mysql数据库,作为一种开源的关系型数据库,以其易学易用等特点,深受同行喜爱,流行度很高,特别是使用过DB2数据库后,就会发现,mysql数据库是多么简单易用,本篇将介绍一下mysql数据库在Linux环境的安装。
一、安装前准备
(1)linux服务器:本次采用centos6.5系统的虚拟机进行安装;
(2)mysql安装包:本次选择mysql5.6版本进行安装,下载网址:https://dev.mysql.com/downloads/mysql/5.6.html#downloads
一直拉到最下面,选择版本后点击下载:
会跳转到一个页面,点击“No thanks, just start my download.”开始下载
(3)上传安装包到服务器
下载完成后,使用FileZilla等ftp工具,将下载的安装包mysql-5.6.42-linux-glibc2.12-x86_64.tar.gz上传到服务器(虚拟机指定目录下),本次上传目录是/install,如图:
二、开始安装
(1)创建mysql文件夹:
mkdir /usr/local/mysql
mkdir /usr/local/mysql/error-log
mkdir /usr/local/mysql/data
echo ''>/usr/local/mysql/error-log/error.log
(2)创建mysql用户组和用户:
groupadd mysql
useradd mysql -g mysql -d /home/mysql
(3)解压安装包
cd /install/
tar -zxvf mysql-5.6.42-linux-glibc2.12-x86_64.tar.gz
(4)移动解压文件到mysql目录:
cd mysql-5.6.42-linux-glibc2.12-x86_64
mv * /usr/local/mysql/
(5)修改mysql目录用户权限
cd /usr/local/mysql/
chown -R mysql:mysql ./
(6)执行安装脚本:
./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql
具体输出内容如下:
[root@localhost scripts]# ./mysql_install_db --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql
Installing MySQL system tables...2019-01-06 20:17:22 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-01-06 20:17:22 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2019-01-06 20:17:22 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.42) starting as process 10306 ...
2019-01-06 20:17:22 10306 [Note] InnoDB: Using atomics to ref count buffer pool pages
2019-01-06 20:17:22 10306 [Note] InnoDB: The InnoDB memory heap is disabled
2019-01-06 20:17:22 10306 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-01-06 20:17:22 10306 [Note] InnoDB: Memory barr