glibc 2.12 mysql_安装mysqlmysql-5.7.24-linux-glibc2.12-x86_64

1、下载mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz(/opt目录)

2、tar -zxvf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz

3、改名称。mv mysql-5.7.24-linux-glibc2.12-x86_64 mysql,在mysql目录下创建data目录,mkdir data

4、在/etc下新建my.cnf。内容如下

#[mysqld]

#datadir=/var/lib/mysql

#socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks

#symbolic-links=0

# Settings user and group are ignored when systemd is used.

# If you need to run mysqld under a different user or group,

# customize your systemd unit file for mariadb according to the

# instructions in http://fedoraproject.org/wiki/Systemd

[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/opt/mysql/data/mysqld.pid

#

# include all files from the config directory

#

#!includedir /etc/my.cnf.d

[client]

port = 3306

socket = /opt/mysql/mysql.sock

default-character-set=utf-8

[mysqld]

#skip-grant-tables

character_set_server=utf8

init_connect='SET NAMES utf8'

basedir=/opt/mysql

datadir=/opt/mysql/data

socket=/opt/mysql/mysql.sock

lower_case_table_names = 1

bind-address = 0.0.0.0

sql_mode=ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

5、在/opt/mysql下新建文件mysql.sock。

touch mysql.sock

chown mysql:mysql mysql.sock

chmod 755 mysql.sock

6、

查看组和用户情况:cat /etc/group | grep mysql

查看组和用户情况:cat /etc/passwd |grep mysql

若存在,则删除原mysql用户:userdel -r mysql,会删除其对应的组和用户并在次查看。

创建mysql组:groupadd mysql

创建mysql用户:useradd -r -g mysql mysql

修改目录拥有者:chown -R mysql:mysql /opt/mysql

7、cd /opt/mysql/bin/目录

./mysqld --user=mysql --basedir=/opt/mysql --datadir=/opt/mysql/data --initialize(需要记住初始密码)

8、./mysqld_safe --user=mysql &

9、./mysql -u root -p

输入初始密码

10、改密码:mysql>set password=password("123456");

11、mysql>grant all privileges on *.* to 'root'@'%' identified by '123456';

12、flush privileges;

13、set global show_compatibility_56=on;

14、mysql> quit;

15、cp -a /opt/mysql/support-files/mysql.server /etc/init.d/mysql

16、ln -s /opt/mysql/bin/mysql /usr/bin

参考:

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值