一、安装环境

宿主机=> win7,虚拟机 centos => 系统版本:centos-release-7-5.1804.el7.centos.x86_64

二、MySQL下载

MySQL Community Server 5.5.62 下载:  https://dev.mysql.com/downloads/mysql/

进入下载页面,复制链接地址

执行命令  wget https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.62-linux-glibc2.12-x86_64.tar.gz

将其下载到  /usr/local/src  目录

[root@bogon src]# wget https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.62-linux-glibc2.12-x86_64.tar.gz
--2018-12-18 03:52:54-- https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.62-linux-glibc2.12-x86_64.tar.gz
Resolving dev.mysql.com (dev.mysql.com)... 137.254.60.11
Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://cdn.mysql.com//Downloads/MySQL-5.5/mysql-5.5.62-linux-glibc2.12-x86_64.tar.gz [following]
--2018-12-18 03:52:55-- https://cdn.mysql.com//Downloads/MySQL-5.5/mysql-5.5.62-linux-glibc2.12-x86_64.tar.gz
Resolving cdn.mysql.com (cdn.mysql.com)... 23.13.185.161
Connecting to cdn.mysql.com (cdn.mysql.com)|23.13.185.161|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 198993245 (190M) [application/x-tar-gz]
Saving to: ‘mysql-5.5.62-linux-glibc2.12-x86_64.tar.gz’
100%[=========================================================>] 198,993,245 11.0MB/s in 19s
2018-12-18 03:53:14 (10.1 MB/s) - ‘mysql-5.5.62-linux-glibc2.12-x86_64.tar.gz’ saved [198993245/198993245]

三、安装MySQL Community Server 5.5.62

1、解压 MySQL Community Server 5.5.62 并移动到 /usr/local 下重命名为  mysql

[root@bogon src]# tar -zxf mysql-5.5.-linux-glibc2.-x86_64.tar.gz
[root@bogon src]# mv mysql-5.5.-linux-glibc2.-x86_64 /usr/local/mysql
[root@bogon src]# ls /usr/local
etc games lib lib64 libevent libexec memcached mysql nginx php7 sbin share src

2、创建mysql用户组和mysql用户名并添加到mysql用户组

[root@bogon local]# groupadd mysql
[root@bogon local]# useradd -g mysql mysql

3、进入/usr/local/mysql目录修改拥有者为mysql用户(组)

[root@bogon mysql]# chown -R mysql:mysql ./
[root@bogon mysql]# ll
total
drwxr-xr-x. mysql mysql Dec : bin
-rw-r--r--. mysql mysql Aug : COPYING
drwxr-xr-x. mysql mysql Dec : data
drwxr-xr-x. mysql mysql Dec : docs
drwxr-xr-x. mysql mysql Dec : include
-rw-r--r--. mysql mysql Aug : INSTALL-BINARY
drwxr-xr-x. mysql mysql Dec : lib
drwxr-xr-x. mysql mysql Dec : man
drwxr-xr-x. mysql mysql Dec : mysql-test
-rw-r--r--. mysql mysql Aug : README
drwxr-xr-x. mysql mysql Dec : scripts
drwxr-xr-x. mysql mysql Dec : share
drwxr-xr-x. mysql mysql Dec : sql-bench
drwxr-xr-x. mysql mysql Dec : support-files

4、编辑 /etc/my.cnf ,加入以下内容

# 设置客户端
[mysql]
default-character-set=utf8
socket=/var/lib/mysql/mysql.sock
# 设置服务端
[mysqld]
skip-name-resolve
port =
socket=/var/lib/mysql/mysql.sock
# 设置mysql的安装目录
basedir=/usr/local/mysql
# 设置mysql数据库的数据的存放目录
datadir=/usr/local/mysql/data
# 允许最大连接数
max_connections=
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
lower_case_table_names=
max_allowed_packet=16M

5、安装mysql

执行 ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data

[root@bogon mysql]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data
Installing MySQL system tables...
:: [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
:: [Note] /usr/local/mysql//bin/mysqld (mysqld 5.5.62) starting as process 2032 ...
OK
Filling help tables...
:: [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
:: [Note] /usr/local/mysql//bin/mysqld (mysqld 5.5.62) starting as process 2039 ...
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 218.28.144.38 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/ ; /usr/local/mysql//bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysql//mysql-test ; perl mysql-test-run.pl Please report any problems at http://bugs.mysql.com/

6、配置mysql

  6.1 修改data拥有者和权限  

[root@bogon mysql]# chown -R mysql:mysql data
[root@bogon mysql]# chmod 777 data

  6.2 修改my.cnf权限

[root@bogon mysql]# chmod  /etc/my.cnf
[root@bogon mysql]# ll /etc/my.cnf
-rwxrwxrwx. root root Dec : /etc/my.cnf

  6.3 修改/var/lib/mysql拥有者为mysql用户(组)

[root@bogon ~]# chown -R mysql:mysql /var/lib/mysql

  6.4 复制mysql.server到/etc/rc.d/init.d/并重命名为mysqld

[root@bogon mysql]# cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
[root@bogon mysql]# ls /etc/rc.d/init.d
functions mysqld netconsole network README

  6.5 增加mysqld执行权限

[root@bogon mysql]# chmod +x /etc/rc.d/init.d/mysqld

  6,6 将mysqld添加到自启动列表

[root@bogon mysql]# chkconfig --add mysqld

7、开启mysqld服务

[root@bogon mysql]# service mysqld start

8、配置PATH环境

[root@bogon mysql]# vi ~/.bash_profile

最后一行加入  export PATH=$PATH:/usr/local/mysql/bin

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export PATH
export PATH=$PATH:/usr/local/mysql/bin

刷新文件

[root@bogon mysql]# source ~/.bash_profile

四、登陆mysql

[root@bogon mysql]# mysql -u root -p
Warning: World-writable config file '/etc/my.cnf' is ignored
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.5. 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>

10、修改root密码

mysql> use mysql;
Database changed
mysql> update user set password=password('abc123456') where user='root' and host='localhost';
Query OK, row affected (0.00 sec)
Rows matched: Changed: Warnings: mysql> flush privileges;
Query OK, rows affected (0.00 sec)

五、配置远程连接mysql

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

使用navicat远程连接mysql

连接

至此,CentOS 7下安装 MySQL-5.5.62 完毕。

CentOS 7 下编译安装lnmp之MySQL篇详解的更多相关文章

  1. CentOS 7 下编译安装lnmp之PHP篇详解

    一.安装环境 宿主机=> win7,虚拟机 centos => 系统版本:centos-release-7-5.1804.el7.centos.x86_64 二.PHP下载 官网 http ...

  2. CentOS 7 下编译安装lnmp之nginx篇详解

    一.安装环境 宿主机=> win7,虚拟机 centos => 系统版本:CentOS Linux release 7.5.1804 (Core),ip地址 192.168.1.168   ...

  3. 在CentOS 7下编译安装Nginx+PHP+MySQL环境

    本文转载自:http://www.softeng.cn/?p=156,本文已获得作者授权,未经作者同意,不可转载. 1.前言 本文适合于已经对Linux操作系统具有基本操作经验,并且能够在Linux或 ...

  4. centos下编译安装lnmp

    centos下编译安装lnmp 本文以centos为背景在其中编译安装nginx搭建lnmp环境. 编译安装nginx时,需要事先安装 开发包组"Development Tools" ...

  5. Centos 6.8编译安装LNMP环境

    Centos 6.8编译安装LNMP环境 参考资料: http://www.jb51.net/article/107429.htm https://phperzh.com/articles/1360 ...

  6. CentOS7编译安装php7.1配置教程详解

    这篇文章主要介绍CentOS7编译安装php7.1的过程和配置详解,亲测 ,需要的朋友可以参考. 1.首先安装依赖包: yum install libxml2 libxml2-devel openss ...

  7. CentOS 6.4 linux下编译安装 LNMP环境

    1.nginx编译安装 2.PHP编译安装 3.mysql编译安装 4.NGINX配置模板 5.CentOS 6.4 php-fpm 添加service 添加平滑启动/重启

  8. centos6.7下编译安装lnmp

    很多步骤不说明了,请参照本人的centos6.7下编译安装lamp,这次的架构是nginx+php-fpm一台服务器,mysql一台服务器 (1)首先编译安装nginx: 操作命令: yum -y g ...

  9. CentOS 6下编译安装MySQL 5.6

    一:卸载旧版本 使用下面的命令检查是否安装有MySQL Server rpm -qa | grep mysql 有的话通过下面的命令来卸载掉 rpm -e mysql //普通删除模式 rpm -e ...

随机推荐

  1. TF-搞不懂的TF矩阵加法

    看谷歌的demo mnist,卷积后加偏执量的代码 h_conv1 = tf.nn.relu(conv2d(x_image, W_conv1) + b_conv1)h_pool1 = max_pool ...

  2. python面向对象(七)属性方法的添加

    ​ 通常情况下,当我们定义了一个class,创建了一个class的实例后,我们可以给该实例绑定任何属性和方法,这就是动态语言的灵活性.下来我就讲下添加属性和方法,同时也将下限值添加属性方法. 添加属性 ...

  3. 洛谷P2017晕牛

    传送门啦 这个题没有想象中复杂. 我们先有向边建立,因为我们无法改变有向边的方向. 建立完之后跑一边拓扑排序,我们按拓扑序小的指向大的就好了. 解释: 我们知道如果一个点在另一个点顺序的后面的话,如果 ...

  4. C#比较时分秒大小,终止分钟默认加十分钟,解决跨天、跨月、跨年的情况

    private void cmbInHostimes_SelectedIndexChanged(object sender, EventArgs e) { DataRow[] dr; if (chkM ...

  5. 更改MyEclipse中的src目录的浏览方式

    看到这个标题,有人可能不会明白,这里先看张图: 右边的图就是我们要更改的样子,有的时候我们做项目需要看下目录的层次,于是使用了Navigator的那个视图,其实常用的这种包视图也可以变成那种样式. 这 ...

  6. hdu 5475 模拟计算器乘除 (2015上海网赛H题 线段树)

    给出有多少次操作 和MOD 初始值为1 操作1 y 表示乘上y操作2 y 表示除以第 y次操作乘的那个数 线段树的叶子结点i 表示 第i次操作乘的数 将1替换成y遇到操作2 就把第i个结点的值 替换成 ...

  7. Singleton 多线程

    单例模式 何为单例模式,在GOF的<设计模式:可复用面向对象软件的基础>中是这样说的:保证一个类只有一个实例,并提供一个访问它的全局访问点.首先,需要保证一个类只有一个实例:在类中,要构造 ...

  8. Java学习笔记之:Spring MVC 环境搭建

    一.创建项目 1.新建java动态项目 2.在web-inf/lib文件夹下导入jar 3.创建所需要的包和文件 二.搭建SpringMVC 1.配置web.xml(WEB-INF下) <?xm ...

  9. 【Java】 foreach对数组赋值问题

    今天写代码时发现了如下问题: public class Test { public static void main(String[] args) { int[] arr= new int[5]; f ...

  10. 洛谷P4645 [COCI2006-2007 Contest#7] BICIKLI [Tarjan,拓扑排序]

    题目传送门 BICIKLI 题意翻译 给定一个有向图,n个点,m条边.请问,1号点到2号点有多少条路径?如果有无限多条,输出inf,如果有限,输出答案模10^9的余数. 两点之间可能有重边,需要看成是 ...