2.二进制安装mysql

一、安装二进制mysql数据库

1. 下载mysql-8.0.18-linux-glibc2.12-x86_64.tar.xz

 2.二进制安装mysql

  1. tar -xf mysql-8.0.18-linux-glibc2.12-x86_64.tar.xz (解压压缩包)
  2. mv mysql-8.0.18-linux-glibc2.12-x86_64    /usr/local/mysql (移动文件夹)
  3. groupadd mysql -r &&  useradd -r -g mysql -M mysql -s /bin/false (给权限)
  4. rpm -e mariadb-libs –nodeps (卸载mariadb)
  5. mkdir /usr/local/mysql/data (创建文件夹)
  6. cat > /etc/my.cnf <<EOF (写入配置文件)
  7. [mysqld]
  8. basedir=/usr/local/mysql/
  9. datadir=/usr/local/mysql/data
  10. pid-file=/usr/local/mysql/data/mysql.pid
  11. socket=/tmp/mysql.sock
  12. log-error=/usr/local/mysql/data/mysql.err
  13. EOF
  14. mysql --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data(初始化数据库)
  15. cp -p /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld (复制启动脚本)
  16. /etc/init.d/mysqld start (启动数据库)
  17. b=`grep password /usr/local/mysql/data/mysql.err | awk -F ‘root@localhost: ‘ ‘{print $2}‘` (过滤密码)
  18. mysql -uroot -p${b} -e ‘alter user root@localhost identified by"123.Com"‘ --connect-expired-password(更改密码)

2.二进制安装mysql

上一篇:使用PL/SQL工具比对表结构,同步表结构


下一篇:数据库设计之主键的思考