常用命令
systemctl start mariadb #启动MariaDB systemctl stop mariadb #停止MariaDB systemctl restart MariaDB #重启mariadb systemctl enable mariadb #设置开机启动
检查
# 检查是否存在MariaDB,一般新的Cen默认存在。 rpm -qa | grep mariadb
配置
# 安装 yum -y install mariadb mariadb-server # 启动 systemctl start mariadb # 自启 systemctl enable mariadb # 密码 mysqladmin -u root password 'root'
连接
# 本机连接 mysql -u root -p # 支持远程连接 use mysql; select user,host from user; update user set host='%' where user='root'; # 出现Duplicate entry '%-root' for key 'PRIMARY'错误可以无视。(主键问题) flush privileges;
问题
- Access denied for user 'root'@'localhost' (using password: YES)
vim /etc 在[mysqld]下方加入skip-grant-tables # 重启数据库 systemctl restart mariadb # 无需输入密码直接回车 mysql -uroot -p use mysql; # 修改密码 123位密码 grant all on *.* to root@'localhost' identified by '123'; exit; # 把之前的skip-grant-tables注释掉 vim /etc # 重启数据库 systemctl restart mariadb
- The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement
flush privileges;
- job for mariadb.service failed because the control process exited with error code .
See "systemctl status mariadb.service" and "journalctl -xe" for details
cat /var/log/mariadb 200211 13:02:58 [ERROR] /usr/libexec/mysqld: unknown variable 'atadir=/var/lib/mysql' # 这是我出现该问题导致的结果,由于修改/etc的时候不小心删除了一个d导致死活启动不起来。
- 远程连接失败
作者:AnimoBlog
链接:
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。