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.735.el6_6.x86_64

6.卸载之前安装过的mysql

[root@master soft]# rpm ‐e ‐‐nodeps mysql‐libs‐5.1.735.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...20180116 04:21:19 0 [Note] Ignoring ‐‐secure‐file‐priv value
 2 as server is running with ‐‐bootstrap.
 3 20180116 04:21:19 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.38) starting as process
 4 1996 ...
 5 20180116 04:21:19 1996 [Note] InnoDB: Using atomics to ref count buffer pool pages
 6 20180116 04:21:19 1996 [Note] InnoDB: The InnoDB memory heap is disabled
 7 20180116 04:21:19 1996 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
 8 20180116 04:21:19 1996 [Note] InnoDB: Memory barrier is not used
 9 20180116 04:21:19 1996 [Note] InnoDB: Compressed tables use zlib 1.2.3
10 20180116 04:21:19 1996 [Note] InnoDB: Using Linux native AIO
11 20180116 04:21:19 1996 [Note] InnoDB: Using CPU crc32 instructions
12 20180116 04:21:19 1996 [Note] InnoDB: Initializing buffer pool, size = 128.0M
13 20180116 04:21:19 1996 [Note] InnoDB: Completed initialization of buffer pool
14 20180116 04:21:19 1996 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a
15 new database to be created!
16 20180116 04:21:19 1996 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
17 20180116 04:21:19 1996 [Note] InnoDB: Database physically writes the file full: wait...
18 20180116 04:21:19 1996 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
19 20180116 04:21:20 1996 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
20 20180116 04:21:20 1996 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
21 20180116 04:21:20 1996 [Warning] InnoDB: New log files created, LSN=45781
22 20180116 04:21:20 1996 [Note] InnoDB: Doublewrite buffer not found: creating new
23 20180116 04:21:20 1996 [Note] InnoDB: Doublewrite buffer created
24 20180116 04:21:20 1996 [Note] InnoDB: 128 rollback segment(s) are active.
25 20180116 04:21:20 1996 [Warning] InnoDB: Creating foreign key constraint system tables.
26 20180116 04:21:20 1996 [Note] InnoDB: Foreign key constraint system tables created
27 20180116 04:21:20 1996 [Note] InnoDB: Creating tablespace and datafile system tables.
28 20180116 04:21:20 1996 [Note] InnoDB: Tablespace and datafile system tables created.
29 20180116 04:21:20 1996 [Note] InnoDB: Waiting for purge to start
30 20180116 04:21:20 1996 [Note] InnoDB: 5.6.38 started; log sequence number 0
31 20180116 04:21:21 1996 [Note] Binlog end
32 20180116 04:21:21 1996 [Note] InnoDB: FTS optimize thread exiting.
33 20180116 04:21:21 1996 [Note] InnoDB: Starting shutdown...
34 20180116 04:21:22 1996 [Note] InnoDB: Shutdown completed; log sequence number 1625977
35 OK
36 Filling help tables...20180116 04:21:22 0 [Note] Ignoring ‐‐secure‐file‐priv value as server
37 is running with ‐‐bootstrap.
38 20180116 04:21:22 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.38) starting as process
39 2018 ...
40 20180116 04:21:22 2018 [Note] InnoDB: Using atomics to ref count buffer pool pages
41 20180116 04:21:22 2018 [Note] InnoDB: The InnoDB memory heap is disabled
42 20180116 04:21:22 2018 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
43 20180116 04:21:22 2018 [Note] InnoDB: Memory barrier is not used
44 20180116 04:21:22 2018 [Note] InnoDB: Compressed tables use zlib 1.2.3
45 20180116 04:21:22 2018 [Note] InnoDB: Using Linux native AIO
46 20180116 04:21:22 2018 [Note] InnoDB: Using CPU crc32 instructions
47 20180116 04:21:22 2018 [Note] InnoDB: Initializing buffer pool, size = 128.0M
48 20180116 04:21:22 2018 [Note] InnoDB: Completed initialization of buffer pool
49 20180116 04:21:22 2018 [Note] InnoDB: Highest supported file format is Barracuda.
50 20180116 04:21:22 2018 [Note] InnoDB: 128 rollback segment(s) are active.
51 20180116 04:21:22 2018 [Note] InnoDB: Waiting for purge to start
52 20180116 04:21:22 2018 [Note] InnoDB: 5.6.38 started; log sequence number 1625977
53 20180116 04:21:22 2018 [Note] Binlog end
54 20180116 04:21:22 2018 [Note] InnoDB: FTS optimize thread exiting.
55 20180116 04:21:22 2018 [Note] InnoDB: Starting shutdown...
56 20180116 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

相关文章:

  • 2021-10-04
  • 2021-05-05
  • 2021-11-19
  • 2021-12-07
  • 2021-12-12
  • 2021-08-20
  • 2021-12-16
猜你喜欢
  • 2021-04-26
  • 2022-01-27
  • 2021-12-05
  • 2022-01-20
  • 2022-12-23
  • 2021-07-15
  • 2021-10-03
相关资源
相似解决方案