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.‐linux‐glibc2.‐x86_64.tar.gz

4.删除mysql-5.6.38-linux-glibc2.12-x86_64.tar.gz并将解压的文件夹重命名为mysql

[root@master soft]# ls
mysql‐5.6.‐linux‐glibc2.‐x86_64 mysql‐5.6.‐linux‐glibc2.‐x86_64.tar.gz
[root@master soft]# rm ‐rf mysql‐5.6.‐linux‐glibc2.‐x86_64.tar.gz
[root@master soft]# mv mysql‐5.6.‐linux‐glibc2.‐x86_64/ mysql

5.查看之前系统是否安装过mysql

[root@master soft]# rpm ‐qa|grep mysql
mysql‐libs‐5.1.‐.el6_6.x86_64

6.卸载之前安装过的mysql

[root@master soft]# rpm ‐e ‐‐nodeps mysql‐libs‐5.1.‐.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
总用量
drwxr‐xr‐x. root root 9月 bin
drwxr‐xr‐x. root root 9月 etc
drwxr‐xr‐x. root root 9月 games
drwxr‐xr‐x. root root 9月 include
drwxr‐xr‐x. root root 9月 lib
drwxr‐xr‐x. root root 9月 lib64
drwxr‐xr‐x. root root 9月 libexec
drwxr‐xr‐x. mysql mysql 1月 : mysql
drwxr‐xr‐x. root root 9月 sbin
drwxr‐xr‐x. root root 1月 : share
drwxr‐xr‐x. root root 9月 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
:: 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
 Installing MySQL system tables...‐‐ ::  [Note] Ignoring ‐‐secure‐file‐priv value
as server is running with ‐‐bootstrap.
‐‐ :: [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.) starting as process
...
‐‐ :: [Note] InnoDB: Using atomics to ref count buffer pool pages
‐‐ :: [Note] InnoDB: The InnoDB memory heap is disabled
‐‐ :: [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
‐‐ :: [Note] InnoDB: Memory barrier is not used
‐‐ :: [Note] InnoDB: Compressed tables use zlib 1.2.
‐‐ :: [Note] InnoDB: Using Linux native AIO
‐‐ :: [Note] InnoDB: Using CPU crc32 instructions
‐‐ :: [Note] InnoDB: Initializing buffer pool, size = 128.0M
‐‐ :: [Note] InnoDB: Completed initialization of buffer pool
‐‐ :: [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a
new database to be created!
‐‐ :: [Note] InnoDB: Setting file ./ibdata1 size to MB
‐‐ :: [Note] InnoDB: Database physically writes the file full: wait...
‐‐ :: [Note] InnoDB: Setting log file ./ib_logfile101 size to MB
‐‐ :: [Note] InnoDB: Setting log file ./ib_logfile1 size to MB
‐‐ :: [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
‐‐ :: [Warning] InnoDB: New log files created, LSN=
‐‐ :: [Note] InnoDB: Doublewrite buffer not found: creating new
‐‐ :: [Note] InnoDB: Doublewrite buffer created
‐‐ :: [Note] InnoDB: rollback segment(s) are active.
‐‐ :: [Warning] InnoDB: Creating foreign key constraint system tables.
‐‐ :: [Note] InnoDB: Foreign key constraint system tables created
‐‐ :: [Note] InnoDB: Creating tablespace and datafile system tables.
‐‐ :: [Note] InnoDB: Tablespace and datafile system tables created.
‐‐ :: [Note] InnoDB: Waiting for purge to start
‐‐ :: [Note] InnoDB: 5.6. started; log sequence number
‐‐ :: [Note] Binlog end
‐‐ :: [Note] InnoDB: FTS optimize thread exiting.
‐‐ :: [Note] InnoDB: Starting shutdown...
‐‐ :: [Note] InnoDB: Shutdown completed; log sequence number
OK
Filling help tables...‐‐ :: [Note] Ignoring ‐‐secure‐file‐priv value as server
is running with ‐‐bootstrap.
‐‐ :: [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.) starting as process
...
‐‐ :: [Note] InnoDB: Using atomics to ref count buffer pool pages
‐‐ :: [Note] InnoDB: The InnoDB memory heap is disabled
‐‐ :: [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
‐‐ :: [Note] InnoDB: Memory barrier is not used
‐‐ :: [Note] InnoDB: Compressed tables use zlib 1.2.
‐‐ :: [Note] InnoDB: Using Linux native AIO
‐‐ :: [Note] InnoDB: Using CPU crc32 instructions
‐‐ :: [Note] InnoDB: Initializing buffer pool, size = 128.0M
‐‐ :: [Note] InnoDB: Completed initialization of buffer pool
‐‐ :: [Note] InnoDB: Highest supported file format is Barracuda.
‐‐ :: [Note] InnoDB: rollback segment(s) are active.
‐‐ :: [Note] InnoDB: Waiting for purge to start
‐‐ :: [Note] InnoDB: 5.6. started; log sequence number
‐‐ :: [Note] Binlog end
‐‐ :: [Note] InnoDB: FTS optimize thread exiting.
‐‐ :: [Note] InnoDB: Starting shutdown...
‐‐ :: [Note] InnoDB: Shutdown completed; log sequence number
OK
To start mysqld at boot time you have to copy
support‐files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/local/mysql/bin/mysqladmin ‐u root password 'new‐password'
/usr/local/mysql/bin/mysqladmin ‐u root ‐h master password 'new‐password'
Alternatively you can run:
/usr/local/mysql/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; /usr/local/mysql/bin/mysqld_safe &
You can test the MySQL daemon with mysql‐test‐run.pl
cd mysql‐test ; perl mysql‐test‐run.pl
Please report any problems at http://bugs.mysql.com/
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as /usr/local/mysql/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings

可能出现的错误

、数据初始化‐主机名解析错误
系统‐Red Hat Enterprise Linux Server release 6.6
软件‐源码安装mysql‐5.6..tar.gz
环境‐Linux rhel6.myexample.com 2.6.‐.el6.x86_64 # SMP Tue Sep :: EDT x86_64
x86_64 x86_64 GNU/Linux
报错:WARNING
[root@rhel6 mysql]# scripts/mysql_install_db ‐‐user=mysql
WARNING: The host 'rhel6.myexample.com' could not be looked up with ./bin/resolveip.
This probably means that your libc libraries are not % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
原因:主机名解析错误。
解决:hosts文件中添加如下内容,ok!
[root@rhel6 mysql]# vi /etc/hosts
192.168.56.20 rhel6.myexample.com
总结:
因为lib库不是很兼容当前MySQL版本。在主机名解析不起作用的情况下,会引起MySQL守护进程、mysqld工作异常,因
此在MySQL中授权时需要使用IP地址,而不能使用主机名。
(不解决该问题,依然可以正确执行scripts/mysql_install_db数据库初始化脚本。)
、数据初始化‐时间戳问题
系统‐Red Hat Enterprise Linux Server release 6.6
软件‐源码安装mysql‐5.6..tar.gz
环境‐Linux rhel6.myexample.com 2.6.‐.el6.x86_64 # SMP Tue Sep :: EDT x86_64
x86_64 x86_64 GNU/Linux
报错:Warning
[root@rhel6 mysql]# scripts/mysql_install_db ‐‐user=mysql
Installing MySQL system tables...‐‐ :: [Warning] TIMESTAMP with implicit DEFAULT
value is deprecated. Please use ‐‐explicit_defaults_for_timestamp server option (see
documentation for more details).
‐‐ :: [Note] ./bin/mysqld (mysqld 5.6.) starting as process ...
原因:机器的系统时间与TIMESTAMP时间戳不匹配。
解决:执行mysql_install_db数据初始化脚本时添加explicit_defaults_for_timestamp选项。
[root@rhel6 mysql]# scripts/mysql_install_db ‐‐user=mysql ‐‐explicit_defaults_for_timestamp
、数据初始化‐重复安装引起多个配置文件,默认配置文件
系统‐Red Hat Enterprise Linux Server release 6.6
软件‐源码安装mysql‐5.6..tar.gz
环境‐Linux rhel6.myexample.com 2.6.‐.el6.x86_64 # SMP Tue Sep :: EDT x86_64
x86_64 x86_64 GNU/Linux
报错:Warning
WARNING: Found existing config file ./my.cnf on the system.
Because this file might be in use, it was not replaced,
but was used in bootstrap (unless you used ‐‐defaults‐file)
and when you later start the server.
The new default config file was created as ./my‐new.cnf,
please compare it with your file and take the changes you need.
WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
‐‐defaults‐file argument to mysqld_safe when starting the server
原因:
Warning1是因为重复安装,导致在安装目录下已经存在my.cnf文件。
Warning2是指默认的my.cnf配置文件在/etc/目录下。
启动Mysql server时,可指定‐‐default‐file=/path/my.cnf参数来启动mysql服务。

13.返回上一级mysql目录,修改data文件及用户组及用户为mysql

[root@master scripts]# cd ..
[root@master mysql]# chown ‐R mysql:mysql data

14.修改mysql密码,之前安装时已经提示如何修改

/usr/local/mysql/bin/mysqladmin ‐u root password 'new‐password'
/usr/local/mysql/bin/mysqladmin ‐u root ‐h master password 'new‐password'
[root@master bin]# ./mysqladmin ‐u root password 'root'

有可能会出现以下错误

[root@master bin]# ./mysqladmin ‐u root password 'root'
./mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' ()'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!
[root@master bin]#

因为这时还没有启动mysql,这算是一个坑。

15.启动mysql,进入mysql/support-files文件夹执行命令

[root@master mysql]# cd support‐files/
[root@master support‐files]# ls
binary‐configure magic my‐default.cnf mysqld_multi.server mysql‐log‐rotate mysql.server
[root@master support‐files]# ./mysql.server start
Starting MySQL.Logging to '/usr/local/mysql/data/master.err'.
SUCCESS!
[root@master support‐files]#

16.在重新执行命令修改密码

[root@master bin]# ./mysqladmin ‐u root password 'root'
Warning: Using a password on the command line interface can be insecure.
[root@master bin]#

17.登录mysql

[root@master bin]# ./mysql ‐uroot ‐p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.6. MySQL Community Server (GPL)
Copyright (c) , , Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>

18.将其他用户的密码也修改为root

update mysql.user set password=password('root') where user='root'; flush privileges;
mysql> update mysql.user set password=password('root') where user='root'; flush privileges;
Query OK, rows affected (0.00 sec)
Rows matched: Changed: Warnings:
Query OK, rows affected (0.00 sec)
mysql>

19.在Windows上远程连接mysql,此时端口不同,关闭Linux上的防火墙

[root@master bin]# service iptables stop
iptables:将链设置为政策 ACCEPT:filter [确定]
iptables:清除防火墙规则: [确定]
iptables:正在卸载模块: [确定]
[root@master bin]#

此时在Windows上用cmd窗口Telnet Linux服务器3306端口报错

D•Host '192.168.1.1' is not allowed to connect to
遗失对主机的连接。
C:\Users\Administrator>telnet 192.168.1.110

为解决这一问题,需要本地登陆MySQL后执行如下命令

mysql> grant all privileges on *.* to root@'%' identified by 'root';
Query OK, rows affected (0.00 sec)
mysql> flush privileges;
Query OK, rows affected (0.00 sec)
mysql>

执行之后即可连接成功

20.将mysql加入services服务

[root@master mysql]# cp support‐files/mysql.server /etc/init.d/mysqld
[root@master mysql]# chkconfig ‐‐add mysqld
[root@master mysql]# chkconfig mysqld on
[root@master mysql]# service mysqld restart
Shutting down MySQL.... SUCCESS!
Starting MySQL. SUCCESS!
[root@master mysql]#

查看状态

[root@master mysql]# service mysqld status
SUCCESS! MySQL running ()
[root@master mysql]#

21.配置my.cnf

[root@master mysql]# vi my.cnf
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at % of total RAM for dedicated server, else %.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
default‐character‐set=utf8
lower_case_table_names=
max_allowed_packet=100M
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = .....
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M

配置好之后充气mysql服务

[root@master data]# service mysqld restart
ERROR! MySQL server PID file could not be found!
Starting MySQL... ERROR! The server quit without updating PID file
(/usr/local/mysql/data/master.pid).

此时报错,查看/usr/local/mysql/data/master.err文件发现报错内容

‐‐ ::  [ERROR] /usr/local/mysql/bin/mysqld: unknown variable 'defaultcharacter‐
set=utf8'
‐‐ :: [ERROR] Aborting

my.cnf字符集设置问题,重新设置为character_set_server=utf8

重新启动解决

[root@master mysql]# service mysqld restart
Shutting down MySQL.. SUCCESS!
Starting MySQL. SUCCESS!
[root@master mysql]#

Linux MySql5.6.38安装过程的更多相关文章

  1. JProfiler远程监控Linux上Tomcat的安装过程细讲(步骤非常详细!!!)

    JProfiler远程监控Linux上Tomcat的安装过程细讲(步骤非常详细!!!) 1.文件准备: 服务器:CentOS Linux release 7.3.1611 (Core)     Apa ...

  2. mysql5.5编译安装过程(自己总结)

    一,安装过程 //创建mysql安装目录,创建数据存放目录,创建用户和用户组与赋予数据存放目录权限 mkdir -p /usr/local/mysql/ mkdir -p /data/mysql/ g ...

  3. (转)linux下mysql的安装过程

    最近在linux安装了mysql,根据网上收集的资料和个人的操作过程,大概做了个整理,以便以后进行参考回顾. 1.下载mysql-5.1.36.tar.gz,并且解压. tar -xzvf mysql ...

  4. linux mysql-5.6.26 安装

    下载地址 ftp://mirror.switch.ch/mirror/mysql/Downloads/MySQL-5.6/mysql-5.6.26-linux-glibc2.5-x86_64.tar. ...

  5. Linux系统源码安装过程中的prefix选项

    在linux和unix环境中,源码安装是最常用的软件安装方式,一些软件除了提供源码外,也提供各种发行版的二进制安装包(如基于redhat包管理工具的rpm包),但强烈建议使用源码安装方式.原因是:(1 ...

  6. linux环境中,nginx安装过程

    需求描述: 记录在linux平台,nginx安装的过程. 环境描述: 操作系统:Red Hat Enterprise Linux Server release 6.6 (Santiago) 操作内核版 ...

  7. 1、linux下mysql5.5.20安装过程报错汇总

    1.Access denied for user 'root'@'localhost' (using password: YES) 这个提示是因为root帐户默认不开放远程访问权限,所以需要修改一下相 ...

  8. linux系统下nodejs安装过程随记

    首先下载适合的版本.这里我使用的是node v.10.36 先介绍编译安装的详细过程. 下载该版本: wget http://nodejs.org/dist/v0.10.36/node-v0.10.3 ...

  9. Linux源码包安装过程及注意事项

    众做周知RedHat Linux使用RPM包管理器安装rpm包,但是RPM包是由红帽编译打包的,通常相对于最新版落后了很多,甚至可能缺少我们所要使用的功能.如果你需要定制想要的软件功能.自定义安装路径 ...

随机推荐

  1. ASP.NET Core 2 学习笔记(十三)Swagger

    Swagger也算是行之有年的API文件生成器,只要在API上使用C#的<summary />文件注解标签,就可以产生精美的线上文件,并且对RESTful API有良好的支持.不仅支持生成 ...

  2. Android开发之旅4:应用程序基础及组件

    引言 为了后面的例子做准备,本篇及接下来几篇将介绍Android应用程序的原理及术语,这些也是作为一个Android的开发人员必须要了解,且深刻理解的东西.本篇的主题如下: 1.应用程序基础 2.应用 ...

  3. python学习之老男孩python全栈第九期_数据库day002 -- 作业 (数据库为day001创建的数据库)

    1.自行创建测试数据 对score表进行优化: 添加数据: 2.查询“生物”课程比“物理”课程成绩高的所有学生的学号: 为了方便做题,额外增加几条数据 查询: 3.查询平均成绩大于60分的同学的学号和 ...

  4. WCF服务使用(IIS+Http)和(Winform宿主+Tcp)两种方式进行发布

    1.写在前面 刚接触WCF不久,有很多地方知其然不知其所以然.当我在[创建服务->发布服务->使用服务]这一过程出现过许多问题.如客户端找不到服务引用:客户端只在本机环境中才能访问服务,移 ...

  5. 小程序视图层(xx.xml)和逻辑层(xx.js)

    整个系统分为两块视图层(View)和逻辑层(App Service) 框架可以让数据与视图非常简单地保持同步.当做数据修改的时候,只需要在逻辑层修改数据,视图层就会做相应的更新. 通过这个简单的例子来 ...

  6. Bootstrap4使用教程

    本篇文章写给那些第一次接触Bootstrap框架的学习者,这篇文章将从最基础最基础的Bootstrap下载开始.对Bootstrap有使用经验的同学可以忽略本篇文章. Bootstrap下载 第一种方 ...

  7. 【Android】Retrofit 2.0 的使用

    一.概述 Retrofit是Square公司开发的一个类型安全的Java和Android 的REST客户端库.来自官网的介绍: A type-safe HTTP client for Android ...

  8. Android 通过URL获取网络资源

    1.先在AndroidManifest.xml中注册加入访问因特网服务的权限: <uses-permission android:name="android.permission.IN ...

  9. Android smartimageview网络图片查看器

    调用代码: SmartImageView siv = (SmartImageView) findViewById(R.id.siv);siv.setImageUrl(et_path.getText() ...

  10. IIS测试环境搭建

    1.控制面板->程序->程序和功能->打开或关闭Windows功能->Internet信息服务->Web管理工具,打开如下服务: 2.打开IIS管理器 2.1检查.net ...