1.下载mysql安装包mysql-5.6.38-linux-glibc2.12-x86_64.tar.gz
2.用xftp工具将其上传到Linux服务器上的soft文件夹,没有的话先创建
[root@master ~]# cd /
[root@master /]# ls
bin dev home lib64 media opt root selinux sys usr
boot etc lib lost+found mnt proc sbin srv tmp var
[root@master /]# mkdir soft
3.解压mysql-5.6.38-linux-glibc2.12-x86_64.tar.gz
[root@master soft]# tar ‐zxvf mysql‐5.6.38‐linux‐glibc2.12‐x86_64.tar.gz
4.删除mysql-5.6.38-linux-glibc2.12-x86_64.tar.gz并将解压的文件夹重命名为mysql
[root@master soft]# ls
mysql‐5.6.38‐linux‐glibc2.12‐x86_64 mysql‐5.6.38‐linux‐glibc2.12‐x86_64.tar.gz
[root@master soft]# rm ‐rf mysql‐5.6.38‐linux‐glibc2.12‐x86_64.tar.gz
[root@master soft]# mv mysql‐5.6.38‐linux‐glibc2.12‐x86_64/ mysql
5.查看之前系统是否安装过mysql
[root@master soft]# rpm ‐qa|grep mysql
mysql‐libs‐5.1.73‐5.el6_6.x86_64
6.卸载之前安装过的mysql
[root@master soft]# rpm ‐e ‐‐nodeps mysql‐libs‐5.1.73‐5.el6_6.x86_64
[root@master soft]# rpm ‐qa|grep mysql
[root@master soft]#
7.查看系统之前是否有mysql用户
[root@master soft]# groups mysql
groups: mysql:无此用户
8.创建mysql用户组及用户
[root@master soft]# groupadd mysql
[root@master soft]# useradd ‐r ‐g mysql mysql
9.将解压的mysql文件夹移动到/usr/local目录下
[root@master soft]# mv mysql/ /usr/local/
10.进入/usr/local/文件夹并修改mysql文件夹用户组及用户为mysql
[root@master soft]# cd /usr/local/
[root@master local]# chown ‐R mysql:mysql mysql
[root@master local]# ll
总用量 44
drwxr‐xr‐x. 2 root root 4096 9月 23 2011 bin
drwxr‐xr‐x. 2 root root 4096 9月 23 2011 etc
drwxr‐xr‐x. 2 root root 4096 9月 23 2011 games
drwxr‐xr‐x. 2 root root 4096 9月 23 2011 include
drwxr‐xr‐x. 2 root root 4096 9月 23 2011 lib
drwxr‐xr‐x. 2 root root 4096 9月 23 2011 lib64
drwxr‐xr‐x. 2 root root 4096 9月 23 2011 libexec
drwxr‐xr‐x. 13 mysql mysql 4096 1月 16 04:04 mysql
drwxr‐xr‐x. 2 root root 4096 9月 23 2011 sbin
drwxr‐xr‐x. 5 root root 4096 1月 16 02:15 share
drwxr‐xr‐x. 2 root root 4096 9月 23 2011 src
[root@master local]#
11.修改/etc/hosts文件夹将IP和主机名添加进去
[root@master scripts]# vi /etc/hosts
192.168.1.110 master
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
12.进入mysql/scripts/文件夹,进行安装
[root@master scripts]# ./mysql_install_db ‐‐basedir=/usr/local/mysql ‐‐
datadir=/usr/local/mysql/data ‐‐user=mysql ‐‐explicit_defaults_for_timestamp
![]()
1 Installing MySQL system tables...2018‐01‐16 04:21:19 0 [Note] Ignoring ‐‐secure‐file‐priv value
2 as server is running with ‐‐bootstrap.
3 2018‐01‐16 04:21:19 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.38) starting as process
4 1996 ...
5 2018‐01‐16 04:21:19 1996 [Note] InnoDB: Using atomics to ref count buffer pool pages
6 2018‐01‐16 04:21:19 1996 [Note] InnoDB: The InnoDB memory heap is disabled
7 2018‐01‐16 04:21:19 1996 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
8 2018‐01‐16 04:21:19 1996 [Note] InnoDB: Memory barrier is not used
9 2018‐01‐16 04:21:19 1996 [Note] InnoDB: Compressed tables use zlib 1.2.3
10 2018‐01‐16 04:21:19 1996 [Note] InnoDB: Using Linux native AIO
11 2018‐01‐16 04:21:19 1996 [Note] InnoDB: Using CPU crc32 instructions
12 2018‐01‐16 04:21:19 1996 [Note] InnoDB: Initializing buffer pool, size = 128.0M
13 2018‐01‐16 04:21:19 1996 [Note] InnoDB: Completed initialization of buffer pool
14 2018‐01‐16 04:21:19 1996 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a
15 new database to be created!
16 2018‐01‐16 04:21:19 1996 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
17 2018‐01‐16 04:21:19 1996 [Note] InnoDB: Database physically writes the file full: wait...
18 2018‐01‐16 04:21:19 1996 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
19 2018‐01‐16 04:21:20 1996 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
20 2018‐01‐16 04:21:20 1996 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
21 2018‐01‐16 04:21:20 1996 [Warning] InnoDB: New log files created, LSN=45781
22 2018‐01‐16 04:21:20 1996 [Note] InnoDB: Doublewrite buffer not found: creating new
23 2018‐01‐16 04:21:20 1996 [Note] InnoDB: Doublewrite buffer created
24 2018‐01‐16 04:21:20 1996 [Note] InnoDB: 128 rollback segment(s) are active.
25 2018‐01‐16 04:21:20 1996 [Warning] InnoDB: Creating foreign key constraint system tables.
26 2018‐01‐16 04:21:20 1996 [Note] InnoDB: Foreign key constraint system tables created
27 2018‐01‐16 04:21:20 1996 [Note] InnoDB: Creating tablespace and datafile system tables.
28 2018‐01‐16 04:21:20 1996 [Note] InnoDB: Tablespace and datafile system tables created.
29 2018‐01‐16 04:21:20 1996 [Note] InnoDB: Waiting for purge to start
30 2018‐01‐16 04:21:20 1996 [Note] InnoDB: 5.6.38 started; log sequence number 0
31 2018‐01‐16 04:21:21 1996 [Note] Binlog end
32 2018‐01‐16 04:21:21 1996 [Note] InnoDB: FTS optimize thread exiting.
33 2018‐01‐16 04:21:21 1996 [Note] InnoDB: Starting shutdown...
34 2018‐01‐16 04:21:22 1996 [Note] InnoDB: Shutdown completed; log sequence number 1625977
35 OK
36 Filling help tables...2018‐01‐16 04:21:22 0 [Note] Ignoring ‐‐secure‐file‐priv value as server
37 is running with ‐‐bootstrap.
38 2018‐01‐16 04:21:22 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.38) starting as process
39 2018 ...
40 2018‐01‐16 04:21:22 2018 [Note] InnoDB: Using atomics to ref count buffer pool pages
41 2018‐01‐16 04:21:22 2018 [Note] InnoDB: The InnoDB memory heap is disabled
42 2018‐01‐16 04:21:22 2018 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
43 2018‐01‐16 04:21:22 2018 [Note] InnoDB: Memory barrier is not used
44 2018‐01‐16 04:21:22 2018 [Note] InnoDB: Compressed tables use zlib 1.2.3
45 2018‐01‐16 04:21:22 2018 [Note] InnoDB: Using Linux native AIO
46 2018‐01‐16 04:21:22 2018 [Note] InnoDB: Using CPU crc32 instructions
47 2018‐01‐16 04:21:22 2018 [Note] InnoDB: Initializing buffer pool, size = 128.0M
48 2018‐01‐16 04:21:22 2018 [Note] InnoDB: Completed initialization of buffer pool
49 2018‐01‐16 04:21:22 2018 [Note] InnoDB: Highest supported file format is Barracuda.
50 2018‐01‐16 04:21:22 2018 [Note] InnoDB: 128 rollback segment(s) are active.
51 2018‐01‐16 04:21:22 2018 [Note] InnoDB: Waiting for purge to start
52 2018‐01‐16 04:21:22 2018 [Note] InnoDB: 5.6.38 started; log sequence number 1625977
53 2018‐01‐16 04:21:22 2018 [Note] Binlog end
54 2018‐01‐16 04:21:22 2018 [Note] InnoDB: FTS optimize thread exiting.
55 2018‐01‐16 04:21:22 2018 [Note] InnoDB: Starting shutdown...
56 2018‐01‐16 04:21:24 2018 [Note] InnoDB: Shutdown completed; log sequence number 1625987
57 OK
58 To start mysqld at boot time you have to copy
59 support‐files/mysql.server to the right place for your system
60 PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
61 To do so, start the server, then issue the following commands:
62 /usr/local/mysql/bin/mysqladmin ‐u root password 'new‐password'
63 /usr/local/mysql/bin/mysqladmin ‐u root ‐h master password 'new‐password'
64 Alternatively you can run:
65 /usr/local/mysql/bin/mysql_secure_installation
66 which will also give you the option of removing the test
67 databases and anonymous user created by default. This is
68 strongly recommended for production servers.
69 See the manual for more instructions.
70 You can start the MySQL daemon with:
71 cd . ; /usr/local/mysql/bin/mysqld_safe &
72 You can test the MySQL daemon with mysql‐test‐run.pl
73 cd mysql‐test ; perl mysql‐test‐run.pl
74 Please report any problems at http://bugs.mysql.com/
75 The latest information about MySQL is available on the web at
76 http://www.mysql.com
77 Support MySQL by buying support/licenses at http://shop.mysql.com
78 New default config file was created as /usr/local/mysql/my.cnf and
79 will be used by default by the server when you start it.
80 You may edit this file to change server settings
View Code