fedora28安装mysql(mariadb)

示例:安装mysql

1、查看是否安装mysql

Yum list installed mysql*

Rpm –qa | grep mysql*

Locate mysql*

2、查看yum源是否有mysql的安装包

Yum list mysql*

         fedora28安装mysql(mariadb)_第1张图片

3、安装mysql客户端

Yum install mysql

         fedora28安装mysql(mariadb)_第2张图片

4、安装mysql服务器端

Yum install mysql-server

fedora28安装mysql(mariadb)_第3张图片

fedora28安装mysql(mariadb)_第4张图片

5、安装mysql开发工具

Yum install mysql-devel

fedora28安装mysql(mariadb)_第5张图片

fedora28安装mysql(mariadb)_第6张图片

6、配置mysql字符集

/etc/my.cnf

Sudo gedit /etc/my.cnf

//最后一行添加 default –character-set = utf8

7、启动mysql服务

systemctl start mariadb.service  开启服务

systemctl stop mariadb.service 关闭服务

systemctl status mariadb.service 服务状态

systemctl restart mariadb.service 重启服务

添加一些配置:

文件/etc/my.cnf

在[mysql]中添加

         init_connect='SET collation_connection = utf8_unicode_ci'

init_connect='SET NAMES utf8' 

character-set-server=utf8 

collation-server=utf8_unicode_ci 

skip-character-set-client-handshake

文件/etc/my.cnf.d/client.cnf

在[client]中添加

default-character-set=utf8

文件/etc/my.cnf.d/mysql-clients.cnf

在[mysql]中添加

default-character-set=utf8

 

错误:

         Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details.'

解决:

1、关闭selinux和防火墙

                  setenforce 0              关闭selinux

                  systemctl stop firewalld.service      关闭防火墙

2、检查配置/etc/my.cnf

3、查看日志:cat /var/log/mariadb/mariadb.log

 

错误:

# mysql -uroot -p

Enter password:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

//sudo mysqld_safe --skip-grant-tables &

解决:

systemctl stop mariadb.service      先关闭

使用进入安全模式:

mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

mysql -u root mysql

UPDATE user SET Password=PASSWORD('newpassword') where USER='root';

FLUSH PRIVILEGES;

Quit

 

systemctl stop mariadb.service

systemctl start mariadb.service

如果发现启动超时,查看下进程是否存在,存在kill

ps uaxww | grep -i mysql

你可能感兴趣的:(linux,Fedora)