1.从网上下载MySQL的压缩包,以gz为结尾
2.打开机器通过rz命令上传到机器里
3.Check isnot install看机器是否装了MySQL,两个命令
ps -ef|grep mysqld
rpm -qa |grep -i mysql

4.tar和mv
切换到cd /usr/local 目录下解压。tar -xzvf mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz
移动mv mysql-5.6.23-linux-glibc2.5-x86_64 mysql

5.Create group and user 创建组和用户
groupadd -g 101 dba
useradd -u 514 -g dba -G root -d /usr/local/mysql mysqladmin
id mysqladminMySQL部署

if user mysqladmin is existing,please execute the following command of usermod.如果创建用户存在,就配置下面的命令

##[[email protected] local]# usermod -u 514 -g dba -G root -d /usr/local/mysql mysqladmin #

copy 环境变量配置文件至mysqladmin用户的home目录中,为了以下步骤配置个人环境变量

[[email protected] local]# cp /etc/skel/.* /usr/local/mysql ###important
cp: omitting directory /etc/skel/.' cp: omitting directory/etc/skel/…’
cp: omitting directory `/etc/skel/.mozilla’

6.Create /etc/my.cnf(640) 配置文件
cd /etc
touch my.cnf
vi my.cnfMySQL部署

innodb_buffer_pool_size = 2048M
修改为innodb_buffer_pool_size = 1024M MySQL部署

7.chown and chmod privileges and try first install
a.chown mysqladmin:dba /etc/my.cnf
b.chmod 640 /etc/my.cnf
c.chown -R mysqladmin:dba /usr/local/mysql
d.chmod -R 755 /usr/local/mysql
e.su - mysqladmin
f.pwd
MySQL部署

创建binlog文件,归档文件
a.mkdir arch
*([[email protected] ~]$ scripts/mysql_install_db ###importInstalling MySQL system tables…/bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory #缺少libaio.so 包###see version[[email protected] local]# cat /proc/versionLinux version 2.6.18-164.11.1.el5 ([email protected]) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) #1 SMP Wed Jan 20 07:32:21 EST 2010[[email protected] local]# rpm -qa |grep gcclibgcc-4.1.2-46.el5_4.2libgcc-4.1.2-46.el5_4.2)

切换到root用户执行
b.yum -y install libaio

8.Again install(切换到 mysqladmin用户执行)
a.scripts/mysql_install_db

9.Configure mysql service and boot auto start(配置mysql的服务和开机自启动)
***用root用户来作
a. cd /usr/local/mysql
b. cp support-files/mysql.server /etc/rc.d/init.d/mysql (#将服务文件拷贝到init.d下,并重命名为mysql)
c. chmod +x /etc/rc.d/init.d/mysql(#赋予可执行权限)
*d.chkconfig --del mysql(删除服务)------一般第一次不用
e.chkconfig --add mysql(添加服务)
f.chkconfig mysql on
g.vi /etc/rc.local 执行下面命令MySQL部署

10.Start mysql and to view process and listening
a.su - mysqladminMySQL部署
b.rm -rf my.cnf
c.which mysqld_safeMySQL部署
d.配置个人环境变量
ll -aMySQL部署

vi .bash_profileMySQL部署

添加MySQL部署

之后用. .bash_profile生效一下

或者用下图操作
MySQL部署

e.mysqld_safe &(按回车直接后台)
f. 用root查看进程和端口号
ps -ef|grep mysqld
netstat -tulnp | grep mysql
service mysql status

11.Login mysql
切换到mysqladmin用户
a.mysql
a1.要是之前登录过有密码密码是123456就用mysql -uroot -p123456
MySQL部署

b.show databases;MySQL部署

12.Update password and Purge user
mysql> use mysql
Database changed
MySQL部署
mysql> select user,password,host from user;(语法)
MySQL部署
mysql> update user set password=password(‘123456’) where user=‘root’;(中间有密码)
mysql> select user,password,host from user;

MySQL部署

mysql> delete from user where user=’’;(删除用户,空密码)
mysql> select user,password,host from user;
MySQL部署
mysql> flush privileges;(刷新权限)

Ctrl+z退出mysql

  1. Configure .bash_profile
    MySQL部署

14.创建用户

1.create database ruozedb;
2.grant all privileges on ruozedb.* to [email protected]’%’ identified by ‘123456’;(%表示ruoze这个用户的密码是任意的,可以改为其他的数字)
3.flush privileges;

MySQL部署
%就是192.168.0.190

15.删除
rm -rf $MYSQL_HOME/arch/* binlog日志 恢复 或是主从同步
rm -rf $MYSQL_HOME/data/* 数据

相关文章:

  • 2021-04-14
  • 2021-08-06
  • 2021-06-29
  • 2021-10-20
  • 2022-02-02
  • 2021-07-01
猜你喜欢
  • 2021-06-08
  • 2021-08-16
  • 2022-12-23
  • 2021-05-28
  • 2021-10-01
相关资源
相似解决方案