1-1 MySQL-5.7部署

最后更新于:2022-04-02 07:43:28

#### 下载MySQL二进制包到/opt目录,开始安装 安装依赖 ```shell yum install libaio* ``` 卸载mariadb ```shell yum remove mariadb-config mariadb-common mariadb-libs ``` 开始安装MySQL ```shell cd /opt && tar xzf mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz mv mysql-5.7.18-linux-glibc2.5-x86_64 /usr/local/ groupadd mysql useradd -r -g mysql -s /bin/false mysql cd /usr/local ln -s mysql-5.7.18-linux-glibc2.5-x86_64 mysql chown -R mysql.mysql /usr/local/mysql-5.7.18-linux-glibc2.5-x86_64 cp /usr/local/mysql/support-files/mysql.server /etc/init.d/ mkdir /data/mysql3306 chown -R mysql.mysql /data/mysql3306/ #上传my.cnf配置文件到/etc/下 cd /usr/local/mysql && bin/mysqld --initialize --user=mysql ``` 启动数据库 ```shell /etc/init.d/mysql.server start ``` 过滤临时密码 ```shell grep "root@localhost:" /data/mysql3306/error.log ``` 修改密码 ```shell alter user root@'localhost' identified by '123.com'; ```
';