安装MariaDB

2024-02-16  本文已影响0人  sknfie

安装数据库

curl -s https://www.alicloud.com/mirrors/repos/mariadb-10.6.repo -o /etc/yum.repos.d/mariadb.repo
yum install MariaDB-server MariaDB-client -y
systemctl start mariadb.service
systemctl enable mariadb.service
mysql -uroot -p
修改密码:
use mysql ;
update user set password=password("root") where user="root";
flush privileges;
授权远程访问:
GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
flush privileges;
创建数据库:
CREATE DATABASE test DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
Use test ;

问题

update user set password=password("root") where user="root";
出现如下问题:
ERROR 1356 (HY000): View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
解决:
alter user root@'localhost' IDENTIFIED BY '000000';

出现如下问题:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'TO 'root'@'%' IDENTIFIED BY '000000' WITH GRANT OPTION' at line 1
解决:
GRANT ALL PRIVILEGES ON . TO root@cdh02 IDENTIFIED BY '000000';
grant all privileges on . to admin_cdc@'%' identified by '000000';

上一篇下一篇

猜你喜欢

热点阅读