Deploy Mysql

Mysql-5.7.18安装:mysql

安装依赖包:linux

# yum search libaiosql

# yum install libaio数据库

新建用户及组:vim

# groupadd mysql服务器

# useradd mysql -g mysqlspa

解压:server

# tar -axvf mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz -C /r2/mysqldatablog

重命名:ip

# mv mysql-5.7.18-linux-glibc2.5-x86_64 mysql

安装:

# cd /r2/mysqldata

更改全部者:

# chown -R mysql.msyql mysql/

受权:

# chmod 755 mysql/

编译安装:

# cd msysql

# ./bin/mysqld --user=mysql --basedir=/r2/mysqldata --datadir=/r2/mysqldata/data --initialize

当编译安装完成时特别注意看下面的初始密码。

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

# chmod 755 /etc/init.d/mysqld

# vi /etc/init.d/mysqld

将下面相关路径修改为本身部署的相对应的目录

 

配置/etc/my.cnf

# vim /etc/my.cnf

  

 

本人同步的是192.168.101.130服务器配置文件

配置环境变量:

# echo "export PATH=$PATH:/r2/mysqldata/bin" >> /etc/profile

# source /etc/profile

启动mysql:

# /etc/init.d/mysqld start

 

注:

1.若是出现UPDATNG PID等错误,请仔细检查配置文件/etc/my.cnf的相关路径设置是否错误和错误提示下相关路径下是否有文件。

2.若忘记了数据库密码可编辑/etc/my.cnf添加:skip-grant-tables

3.在跳过密码后登陆设置密码:

> update mysql.user set authentication_string=password('新密码') where user='root';

4.注释掉配置文件中跳过密码,使用密码登陆MySQL,若要再次修改密码

> set password = password('xxxxxxxx');

> flush privileges;

5.受权:> GRANT ALL PRIVILEGES ON *.* TO 'root'@'luomr' IDENTIFIED BY '123456' WITH GRANT OPTION;

相关文章
相关标签/搜索