在linux下用二进制方式安装mysql8

华为欧拉操作系统版本:openEuler 20.03-LTS-SP4

因为我用的笔记本安装的,需要无线网卡驱动,所以采用的这个版本,高版本无法识别无线网卡驱动

rpm -qa | grep mariadb
rpm -e --nodeps mariadb-connector-c-3.0.6-9.oe2003sp4.x86_64
mkdir /usr/local/mysql
cd /usr/local/mysql
wget https://cdn.mysql.com/archives/mysql-8.0/mysql-8.0.18-linux-glibc2.12-x86_64.tar.xz
tar xvJf mysql-8.0.18-linux-glibc2.12-x86_64.tar.xz
mv mysql-8.0.18-linux-glibc2.12-x86_64 mysql8.0
mkdir /usr/local/mysql/mysql8.0/data
groupadd mysql
useradd -g mysql mysql
chown -R mysql.mysql /usr/local/mysql/mysql8.0/
cd mysql8.0/bin
./mysqld --user=mysql --basedir=/usr/local/mysql/mysql8.0 --datadir=/usr/local/mysql/mysql8.0/data/ --initialize
2024-11-19T14:30:31.547633Z 0 [System] [MY-013169] [Server] /usr/local/mysql/mysql8.0/bin/mysqld (mysqld 8.0.18) initializing of server in progress as process 1570

2024-11-19T14:30:35.546952Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: muaQVm3kfc#h

这个muaQVm3kfc#h就是mysql的初始密码

cd ../
cp -a ./support-files/mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql
chkconfig --add mysql

去编辑 etc下的profile文件,在最底下添加下面这行

PATH=/usr/local/mysql/mysql8.0/bin:/usr/local/mysql/mysql8.0/lib:$PATH
source /etc/profile
ln -s /usr/local/mysql/mysql8.0/bin/mysql /usr/bin
ln -s /usr/local/mysql/mysql8.0/bin/my_print_defaults /usr/bin

my.cnf文件内容如下,放在/etc目录下

mysqld

basedir=/usr/local/mysql/mysql8.0

datadir=/usr/local/mysql/mysql8.0/data

default-storage-engine=INNODB

character-set-server=utf8mb4

collation-server=utf8mb4_general_ci

port=3306

socket=/tmp/mysql.sock
service mysql start
mysql -u root -p

然后输入mysql的默认初始密码

muaQVm3kfc#h

修改mysql密码

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mysql80_123456';
FLUSH PRIVILEGES;
use mysql
update user set user.Host='%'where user.User='root';
FLUSH PRIVILEGES;
exit;
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload

相关推荐
宁zz9 小时前
乌班图安装jenkins
运维·jenkins
无名之逆9 小时前
Rust 开发提效神器:lombok-macros 宏库
服务器·开发语言·前端·数据库·后端·python·rust
大丈夫立于天地间9 小时前
ISIS协议中的数据库同步
运维·网络·信息与通信
cg50179 小时前
Spring Boot 的配置文件
java·linux·spring boot
暮云星影9 小时前
三、FFmpeg学习笔记
linux·ffmpeg
rainFFrain10 小时前
单例模式与线程安全
linux·运维·服务器·vscode·单例模式
GalaxyPokemon10 小时前
Muduo网络库实现 [九] - EventLoopThread模块
linux·服务器·c++
mingqian_chu10 小时前
ubuntu中使用安卓模拟器
android·linux·ubuntu
xujiangyan_11 小时前
nginx的反向代理和负载均衡
服务器·网络·nginx