源码安装mysql5.3.35

centos7.6安装
[[email protected] ~]# yum install wget vim -y

设置selinux为disabled

[[email protected] ~]# vim /etc/selinux/config
SELINUX=disabled
[[email protected] ~]# source /etc/selinux/config
停止firewalld防火墙(也可以不停止,开放对应端口就行,因为我们这有对外防火墙,所以为了方便直接关闭)
[[email protected] ~]# systemctl stop firewalld.service
[[email protected] ~]# systemctl disable firewalld.service
卸载系统自带的Mariadb
[[email protected] ~]# rpm -qa|grep mariadb
[[email protected] ~]# rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64
删除etc目录下的my.cnf
[[email protected] ~]# rm -rf /etc/my.cnf
安装mysql5.6
安装必要的组件
[[email protected] ~]# yum install autoconf automake imake libxml2-devel expat-devel cmake gcc gcc-c++ libaio libaio-devel bzr bison libtool ncurses5-devel -y
下载解压mysql软件
以下链接是谷歌云盘
https://drive.google.com/open?id=1vzCURG2PnpCeSGJMmVMqfVvz40_Y-pV-
以下链接是mysql官方
[[email protected] ~]# wget https://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
[[email protected] ~]# cd /usr/local/
[[email protected] local]# wget https://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
[[email protected] local]# tar xvf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
[[email protected] local]# mv mysql-5.6.35-linux-glibc2.5-x86_64 mysql
执行以下命令来创建mysql用户组
[[email protected] local]# groupadd mysql
执行以下命令来创建一个用户名为mysql的用户并加入mysql用户组
[[email protected] local]# useradd -g mysql mysql
copy一份/usr/local/mysql/support-files/下的my-default.cnf文件到/etc下
进入此目录
[[email protected] mysql]# pwd
/usr/local/mysql
[[email protected] mysql]# cp support-files/my-default.cnf /etc/my.cnf
配置/etc目录下的my.cnf文件
[[email protected] ~]# vim /etc/my.cnf
[mysql]
设置mysql客户端默认字符集
default-character-set=utf8
socket=/var/lib/mysql/mysql.sock

[mysqld]
skip-name-resolve
设置3306端口
port = 3306
socket=/var/lib/mysql/mysql.sock
设置mysql的安装目录
basedir=/usr/local/mysql
设置mysql数据库的数据的存放目录
datadir=/usr/local/mysql/data
允许最大连接数
max_connections=200
服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
lower_case_table_name=1
max_allowed_packet=16M
创建 /var/lib/mysql文件 并赋予权限
[[email protected] mysql]# mkdir -p /var/lib/mysql
[[email protected] mysql]# chmod -R 777 /var/lib/mysql
进入安装mysql软件目录

[[email protected] mysql]# cd /usr/local/mysql
修改当前目录拥有着为mysql用户
[[email protected] mysql]# chown -R mysql:mysql ./
安装数据库
[[email protected] mysql]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/



出现以下界面没有报错就是成功
修改当前data目录的拥有者为mysql用户

[[email protected] mysql]# chown -R mysql:mysql data
授予my.cnf最大权限
[[email protected] mysql]# chmod 777 /etc/my.cnf
复制启动脚本到资源目录

[[email protected] mysql]# cp support-files/mysql.server /etc/init.d/mysqld
增加mysqld服务控制脚本执行权限

[[email protected] mysql]# chmod +x /etc/rc.d/init.d/mysqld
//将mysqld服务加入到系统服务
[[email protected] mysql]# chkconfig --add mysqld

检查mysqld服务是否已经生效
[[email protected] mysql]# chkconfig --list mysqld
//启动mysqld
[[email protected] mysql]# service mysqld start
Warning: World-writable config file ‘/etc/my.cnf‘ is ignored
Starting MySQL.Warning: World-writable config file ‘/etc/my.cnf‘ is ignored
Warning: World-writable config file ‘/etc/my.cnf‘ is ignored
Logging to ‘/usr/local/mysql/data/node02.err‘.
.. SUCCESS!

将mysql的bin目录加入PATH环境变量,编辑 ~/.bash_profile文件
[[email protected] mysql]# vim ~/.bash_profile
[[email protected] mysql]# tailf ~/.bash_profile
export PATH=$PATH:/usr/local/mysql/bin
/执行下面的命令是修改的内容立即生效:
[[email protected] mysql]# source ~/.bash_profile
以root账户登录mysql,默认是没有密码的
[[email protected] mysql]# mysql -uroot -p

设置root账户密码为123456(也可以修改成你要的密码)
mysql> use mysql;

mysql> update user set password=password(‘123456‘) where user=‘root‘ and host=‘localhost‘;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
设置远程主机登录,注意下面的your username 和 your password改成你需要设置的用户和密码
mysql> GRANT ALL PRIVILEGES ON . TO ‘root‘@‘%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

原文地址:https://blog.51cto.com/xia1314520ting/2417038

时间: 2024-08-12 03:36:25

源码安装mysql5.3.35的相关文章

在rhel7.2下源码安装mysql-5.6.35

如何在一台新机rhel7.2下源码安装mysql-5.6.35 一.前期准备工作 1.首先安装依赖包,避免在安装过程中出现问题 yum -y install gcc gcc-c++ cmake ncurses-devel autoconf perl perl-devel 2.下载源码包 源码包地址:https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.35.tar.gz 3.创建mysql安装目录以及数据存放目录 [[email prot

CentOS6.5源码安装MySQL5.6.35

接上一篇文章使用RPM包安装MySQL,确实很方便.但是安装后却不知道各文件保存在哪个文件夹下!尝试使用源码安装~本文主要参考:CentOS 6.4下编译安装MySQL 5.6.14 一.卸载旧版本 1.使用下面的命令检查是否安装有mysql [[email protected] tools]# rpm -qa|grep -i mysql 2.有的话就卸载 [[email protected] tools]# yum remove MySQL-server-5.6.35-1.el6.i686 [

CentOs 7 64位 源码安装mysql-5.6.35

首先安装依赖包,避免在安装过程中出现问题 [[email protected] liuzhen]# yum -y install gcc gcc-c++ [[email protected] liuzhen]# yum -y install cmake [[email protected] liuzhen]# yum -y install ncurses-devel [[email protected] liuzhen]# yum -y install autoconf [[email prot

MYSQL Study案例之--RedHat EL55源码安装Mysql-5.6

MYSQL  Study案例之--RedHat EL55源码安装Mysql-5.6 系统环境: 操作系统:RedHat EL55 DB Soft:  Mysql 5.6.4-m7 1.系统环境 [[email protected] Packages]# uname -a Linux rh6 2.6.18-194.el5.xen #1 SMP Tue Jan 29 11:47:41 EST 2013 i386 i686 GNU/Linux [[email protected] Packages]#

centos 7.4源码安装mysql5.5.20

安装环境: centos 7.4 + mysql 5.5.20 步骤: (1)     源码安装MYSQL5.5.20方法,通过cmake.make.make install三个步骤实现. 安装mysql需要的包:yum install -y cmake make gcc gcc-c++ wget ncurses-devel cmake make perl ncurses-devel openssl-devel bison-devel libaio libaio-devel PCRE是一个Per

源码安装mysql5.6.20&&mysql主从设置(多实例做多个主从)

一.源码安装mysql5.6.20 1.编译环境安装 yum install wget gcc* make openssl openssl-devel openssl-clients -y && yum groupinstall "Development Libraries" -y 2.源码下载(软件见Linux部署源码包) wget -P /usr/local/src/ http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.

Linux下源码安装Mysql5.5

本文主要介绍了如何在源码安装mysql5.5,所用系统为CentOS6.5 一.安装相应的开发环境 yum install -y ncurses-devel yum install -y libaio yum install -y bison yum install -y gcc-c++ yum install -y openssl-devel 二.安装cmake 跨平台编译器 # tar xf cmake-2.8.8.tar.gz # cd cmake-2.8.8 # ./bootstrap

CentOS 6.5 源码安装MySQL5.6

CentOS 6.5 源码安装MySQL5.6 1:下载安装cmake (mysql5.5以后是通过cmake来编译的) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 #http://download.csdn.net/detail/csxuedn/7976005 #wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz # tar -zxv -f /root/cmake-2.8.4.tar.gz

源码安装mysql5.6x启动报错:[ERROR] Can't find messagefile '/data/mysqldata/3306/english/errmsg.sys'

170502 10:43:40 mysqld_safe Starting mysqld daemon with databases from /data/mysqldata/3306/data 2017-05-02 10:43:40 0 [Warning] The syntax '--language/-l' is deprecated and will be removed in a future release. Please use '--lc-messages-dir' instead.