sudo cat /etc/mysql/debian.cnf mysql -udebian-sys-maint -pxxx
# 修改密码 show databases; use mysql; flush privileges; UPDATE user SET authentication_string="" WHERE user="root"; flush privileges; ALTER user 'root'@'localhost' IDENTIFIED BY 'Ycm@123nihao'; quit;
# 解决localhost root无法登陆的问题 sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf # 加入skip-grant-tables mysql -uroot -p set host = '%'where user = 'root'; update user set host = '%'where user = 'root';
# 建表 mysql> CREATE DATABASE confluence CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; SET GLOBAL tx_isolation='READ-COMMITTED'; # mysql8.0创建用户必须分两步 create user 'confluence'@'%' identified by '123456'; grant all privileges on *.* to 'confluence'@'%' with grant option; FLUSH PRIVILEGES;
# error ('mysql.infoschema'@'localhost') does not exist mysql> DROP USER 'mysql.infoschema'@'localhost'; CREATE USER 'mysql.infoschema'@'localhost' IDENTIFIED BY 'password'; GRANT SELECT ON *.* TO `mysql.infoschema`@`localhost`;