1:mysql8.0下载地址
https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.17-linux-glibc2.12-x86_64.tar.xz
[参考二:](https://my.oschina.net/u/928852/blog/1840371)
3:修改密码:mysql -uroot -p
alter user user() identified by "123456";
4:navicat连接失败,报错’caching_sha2_password’ cannot be loaded,参考直通车
5:可能会出现的问题
-
我遇到的坑:Operation ALTER USER failed for ‘root’@‘localhost’
解决直通车 -
服务启动失败:
注释掉:#log-error=/var/log/mariadb/mariadb.log #pid-file=/var/run/mariadb/mariadb.pid
my.cnf 文件
[mysqld]
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
socket = /usr/local/mysql/mysql.sock
character-set-server=utf8
port = 3306
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[client]
socket = /usr/local/mysql/mysql.sock
default-character-set=utf8
[mysqld_safe]
#log-error=/var/log/mariadb/mariadb.log
#pid-file=/var/run/mariadb/mariadb.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
default_authentication_plugin=mysql_native_password
得执行生效:
flush privileges;
内存不足解决办法:
The server quit without updating PID file (/usr/local/mysql[FAILED]stance-fp0ma14n.pid).
权限不足
/usr/local/mysql/bin/mysqld_safe --user=root &
服务不能启动可参考
https://www.cnblogs.com/richiewlq/p/7521343.html
解决办法:
rm -rf /usr/local/mysql/data
chown -R mysql.mysql .
cd /usr/local/mysql
bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
/usr/local/mysql/bin/mysqld_safe --user=root &
/etc/init.d/mysqld start
use mysql
update user set host=’%’ where user=‘root’ limit 1;
ALTER USER ‘root’@’%’ IDENTIFIED WITH mysql_native_password BY ‘123456’;
alter user user() identified by “123456”;
内存不足导出mysql服务挂掉:
参考地址:https://blog.csdn.net/qq_41133227/article/details/94392512
我的my.cnf配置
[mysqld]
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
socket = /usr/local/mysql/mysql.sock
character-set-server=utf8
port = 3306
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[client]
socket = /usr/local/mysql/mysql.sock
default-character-set=utf8
key_buffer=16K
table_open_cache=4
query_cache_limit=256K
query_cache_size=4M
max_allowed_packet=1M
sort_buffer_size=64K
read_buffer_size=256K
thread_stack=64K
innodb_buffer_pool_size = 56M