系统:Ubuntu 16.04LTS
1/官网下载mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz
2/建立工作组:
$su#groupadd mysql#useradd -r -g mysql mysql |
3/创建目录
#mkdir /usr/local/mysql#mkdir /usr/local/mysql/data |
4/解压mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz,并拷贝至/usr/local/mysql
#tar -zxvf mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz#cp -r /home/jieyamulu/mysql-5.7.18-linux-glibc2.5-x86_64/* /usr/local/mysql |
5/修改mysql用户对mysql以下及其子文件夹以下文件的权限,修改后可使用ll查看权限
root@Ice-***:/usr/local# chown -R mysql:mysql mysqlroot@Ice-***:/usr/local# ll总用量 44drwxr-xr-x 11 root root 4096 5月 19 07:39 ./drwxr-xr-x 11 root root 4096 2月 16 04:30 ../drwxr-xr-x 2 root root 4096 2月 16 04:19 bin/drwxr-xr-x 2 root root 4096 2月 16 04:19 etc/drwxr-xr-x 2 root root 4096 2月 16 04:19 games/drwxr-xr-x 2 root root 4096 2月 16 04:19 include/drwxr-xr-x 4 root root 4096 2月 16 04:23 lib/lrwxrwxrwx 1 root root 9 3月 29 14:11 man -> share/man/drwxr-xr-x 10 mysql mysql 4096 5月 19 07:48 mysql/drwxr-xr-x 2 root root 4096 2月 16 04:19 sbin/drwxr-xr-x 8 root root 4096 2月 16 04:34 share/drwxr-xr-x 2 root root 4096 2月 16 04:19 src/root@Ice-***:/usr/local# cd mysql/root@Ice-***:/usr/local/mysql# ll总用量 64drwxr-xr-x 10 mysql mysql 4096 5月 19 07:48 ./drwxr-xr-x 11 root root 4096 5月 19 07:39 ../drwxr-xr-x 2 mysql mysql 4096 5月 19 07:48 bin/-rw-r--r-- 1 mysql mysql 17987 5月 19 07:48 COPYINGdrwxr-xr-x 2 mysql mysql 4096 5月 19 07:41 data/drwxr-xr-x 2 mysql mysql 4096 5月 19 07:48 docs/drwxr-xr-x 3 mysql mysql 4096 5月 19 07:48 include/drwxr-xr-x 5 mysql mysql 4096 5月 19 07:48 lib/drwxr-xr-x 4 mysql mysql 4096 5月 19 07:48 man/-rw-r--r-- 1 mysql mysql 2478 5月 19 07:48 READMEdrwxr-xr-x 28 mysql mysql 4096 5月 19 07:48 share/drwxr-xr-x 2 mysql mysql 4096 5月 19 07:48 support-files/ |
6/修改(或新建)/etc/my.cnf 配置文件
root@Ice-***:/usr/local/mysql# vim /etc/my.cnf [mysqld] basedir=/usr/local/mysql/datadir=/usr/local/mysql/data:wq |
7/最关键的初始化
# cd /usr/local/mysql/root@Ice-***:/usr/local/mysql# ./bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize2017-05-19T00:15:46.529420Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2017-05-19T00:15:47.066125Z 0 [Warning] InnoDB: New log files created, LSN=457902017-05-19T00:15:47.213711Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.2017-05-19T00:15:47.286951Z 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: 4e958344-3c28-11e7-8334-c8d3ffd2db82.2017-05-19T00:15:47.292857Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.2017-05-19T00:15:47.294758Z 1 [Note] A temporary password is generated for root@localhost: YjaotQk*2ew4 |