yum install -y perl-Module-Install.noarch

yum -y install perl perl-devel

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

#命令下载mysql

wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz

tar -zxvf mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz

#复制解压后的mysql目录

cp -r mysql-5.6.33-linux-glibc2.5-x86_64 /usr/local/mysql

#添加用户组

groupadd mysql

#添加用户mysql 到用户组mysql

useradd -g mysql mysql

cd /usr/local/mysql/

mkdir ./data/mysql

chown -R mysql:mysql ./

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

cp support-files/mysql.server /etc/init.d/mysqld

chmod 755 /etc/init.d/mysqld

cp support-files/my-default.cnf /etc/my.cnf

#修改启动脚本

vi /etc/init.d/mysqld

#修改项:

basedir=/usr/local/mysql/

datadir=/usr/local/mysql/data/mysql

#删除/etc/my.cnf文件

rm -f /etc/my.cnf

#启动服务

service mysqld start

#更换密码

./bin/mysqladmin -u root -h localhost.localdomain password 'root'

#登录mysql

./bin/mysql -h127.0.0.1 -uroot -proot

#登录之后将其他用户的密码也可改为root

update mysql.user set password=password('root') where user='root';

flush privileges;

#远程访问

GRANT ALL PRIVILEGES ON *.* to 'root'@'192.168.1.10' identified by '123456'; 

flush privileges;

#加入环境变量,

export PATH=$PATH:/usr/local/mysql//bin

source /etc/profile

#测试,任意目录下执行进行访问数据库服务

mysql -uroot -proot

  Centos7下安装mysql服务 Linux

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄