Fedora install mariadb

1. Install mariadb

yum install mysql-server

insert image description here

Two, start mariadb

systemctl start mariadb,可能会报错,且报错信息显示如下:

insert image description here

Troubleshooting

● Check mariadb service status

systemctl status mariadb.service,可以看到mariadb服务运行异常

insert image description here
● View mariadb log

tail /var/log/mariadb/mariadb.log,可以看到报错信息:Could not open......loaded

insert image description here
● According to the error information Baidu query solution

1. 停止mariadb服务:systemctl stop mariadb,
2. 删除所有mysql lib文件:rm -r /var/lib/mysql/*
3. 执行该命令:mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
4. 启动mariadb服务:systemctl start mariadb
5. 检查mariadb服务是否正常启动:systemctl status mariadb.service

insert image description here
insert image description here
insert image description here

3. Set the boot to start automatically

systemctl enable mariadb

insert image description here

Fourth, initialize mariadb

mysql_secure_installation

# 注:运行结果用 ··· 代替
Enter current password for root (enter for none):  # 输入root(mysql)的密码,初次安装默认没有,直接回车 
 ... 
Switch to unix_socket authentication [Y/n] n # 是否切换到unix套接字身份验证[Y/n]
 ... 
Change the root password? [Y/n] y #是否设置root用户密码
New password: # 新密码
Re-enter new password:  # 再次输入密码
 ... 
Remove anonymous users? [Y/n] y # 是否删除匿名用户,建议删除
 ... 
Disallow root login remotely? [Y/n] n # 是否禁止root远程登录,建议开启
 ... 
Remove test database and access to it? [Y/n] n # 是否删除test数据库,可以保留
...
Reload privilege tables now? [Y/n] y # 是否重新加载权限表,也可以直接回车
 ... 
Thanks for using MariaDB! # 看到这句话证明设置成功

insert image description here

5. Test whether mariadb can log in normally

输入:mysql -u root -p,测试可以正常登陆

insert image description here

Six, set the character set

进入配置文件:vi /etc/my.cnf.d/client.cnf ,添加:default-character-set=utf8

insert image description here

Seven, check the character set

insert image description here

8. Turn off the firewall

永久关闭防火墙:systemctl disable firewalld.service 

insert image description here

Nine, open remote login

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY '123456' WITH GRANT OPTION;

insert image description here

10. Test

insert image description here

Guess you like

Origin blog.csdn.net/qq_45194089/article/details/124547238