银河麒麟v10 安装mysql 8.35
- 1、下载Mysql安装包
- 2、安装Mysql 8.35
- 2.1、安装依赖包
- 2.2、安装Mysql
- 2.3、安装后配置
1、下载Mysql安装包
访问官网下载链接 链接: https://dev.mysql.com/downloads/mysql/
选择如下 点击下载按钮 下载安装包
2、安装Mysql 8.35
官方安装文档 链接: https://dev.mysql.com/doc/mysql-installation-excerpt/8.0/en/binary-installation.html
2.1、安装依赖包
yum search libaio
yum install libaio
2.2、安装Mysql
命令顺序如下 安装包放在/root/package/mysql/mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
cd /usr/local
tar xvf /root/package/mysql/mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz
ln -s /usr/local/mysql-8.0.35-linux-glibc2.28-x86_64/ mysql
cd mysql
mkdir mysql-files
chown mysql:mysql mysql-files
chmod 750 mysql-files
echo -e "[mysqld]\nbasedir=/opt/mysql/mysql\ndatadir=/opt/mysql/mysql/data\necho socket=/var/lib/mysql/mysql.sock >> /etc/my.cnf" >> /etc/my.cnf
mkdir -p /opt/mysql/mysql/data/
mkdir -p /opt/mysql/mysql
bin/mysqld --defaults-file=/etc/my.cnf --initialize --user=mysql
bin/mysql_ssl_rsa_setup
bin/mysqld_safe --user=mysql &
# Next command is optional
cp support-files/mysql.server /etc/init.d/mysql.server
执行bin/mysqld --initialize --user=mysql 会打印出Mysql的默认密码
8B<Sr<,ad_qo
添加mysql的环境变量
export PATH=$PATH:/usr/local/mysql/bin
2.3、安装后配置
链接: https://dev.mysql.com/doc/mysql-installation-excerpt/8.0/en/postinstallation.html
修改Mysql默认密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root-password';