🥚今日鸡汤🥚
等风来,不如追风去。
???????????????????????????????????????????????????????????????????????????????——《一禅小和尚》
目录
使用命令查看
rpm -qa |grep glibc
?
tar -xzvf mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
mv mysql-8.0.11-linux-glibc2.12-x86_64/ mysql-8.0.11
groupadd mysql
useradd -r -g mysql mysql
groups mysql
?若存在则显示 mysql : mysql ;若不存在,则显示 groups: mysql: No such user
chown -R mysql:mysql /usr/local/mysql-8.0.11
进入 /etc/my.cnf,添加配置
[mysqld]
basedir=/usr/local/mysql-8.0.33
datadir=/usr/local/mysql-8.0.33/data
port=3306
socket=/tmp/mysql.sock
character_set_server=utf8
lower_case_table_names=1
log-error=/usr/local/mysql-8.0.33/data/mysql.log
pid-file=/usr/local/mysql-8.0.33/data/mysql.pid
[mysql]
default-character-set = utf8
在mysql- 8.0.33目录下创建data目录
mkdir data
./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql-8.0.11/ --datadir=/usr/local/mysql-8.0.11/data/
进入配置文件
vim /etc/profile
在文件最后添加配置?
export MYSQL_HOME="/usr/local/mysql-8.0.11"
export PATH="$PATH:$MYSQL_HOME/bin"
配置文件立即生效?
source /etc/profile
service mysql start
?如果报错:Redirecting to /bin/systemctl restart mysql.service Failed to restart mysql.service: Unit not found
解决:感谢这位大佬
mysql -u root -p 密码
初始密码查看/data/mysql.log进行查找
use mysql;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的密码';
flush privileges;
create user 'root'@'%' identified by '你的密码';
grant all privileges on *.* to 'root'@'%';
flush privileges;
update user set host='%' where user = 'root';
如果报错:ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'
执行语句查看host是否有%,只要有%即可
select host,user from user where user='root';
退出mysql,使用密码重新登陆
exit
mysql -u root -p
?至此mysql二进制方式安装完成,放飞自我吧!!!