fedora22 mysql安装

fedora19以后好像取消了对mysql的支持,看其他人好像说是用的mariadb的。centos里用yum安装的方式,放到fedora中不能用,所以找了很多资料,尝试了一种可行的办法。

 

 

 

在Fedora 24/23/22,安装CentOS的MySQL数据库5.7.13 7.2 / 6.8 / 5.11,红帽(RHEL)7.2 / 6.8 / 5.11

1.更改root用户

Shell
0
1
2
3
4
 
su -
## OR ##
sudo -i
 

2.安装MySQL YUM资源库

Fedora的

Shell
0
1
2
3
4
5
6
7
8
9
 
## Fedora 24 ##
dnf install https://dev.mysql.com/get/mysql57-community-release-fc24-8.noarch.rpm
 
## Fedora 23 ##
dnf install https://dev.mysql.com/get/mysql57-community-release-fc23-8.noarch.rpm
 
## Fedora 22 ##
dnf install https://dev.mysql.com/get/mysql57-community-release-fc22-8.noarch.rpm
 

CentOS的和Red Hat(RHEL)

Shell
0
1
2
3
4
5
6
7
8
9
 
## CentOS 7 and Red Hat (RHEL) 7 ##
yum localinstall https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
 
## CentOS 6 and Red Hat (RHEL) 6 ##
yum localinstall https://dev.mysql.com/get/mysql57-community-release-el6-8.noarch.rpm
 
## CentOS 5 and Red Hat (RHEL) 5 ##
yum localinstall https://dev.mysql.com/get/mysql57-community-release-el5-7.noarch.rpm
 

3.更新或安装MySQL 5.7.13

Fedora的24/23/22

Shell
0
1
2
 
dnf install mysql-community-server
 

Fedora的21,CentOS的7.2 / 6.8 / 5.11和Red Hat(RHEL)7.2 / 6.8 / 5.11

Shell
0
1
2
 
yum install mysql-community-server
 

在启动4.启动MySQL服务器和MySQL的自动启动

Fedora的24/23/22和CentOS 7.2

Shell
0
1
2
3
4
 
systemctl start mysqld.service ## use restart after update
 
systemctl enable mysqld.service
 

CentOS的6.8 / 5.11和Red Hat(RHEL)6.8 / 5.11

Shell
0
1
2
3
4
5
6
 
/etc/init.d/mysql start ## use restart after update
## OR ##
service mysql start ## use restart after update
 
chkconfig --levels 235 mysqld on
 
 
好像是由于mysql特性的问题,所以在fedora22之上,mysql5.x安装的时候是不问你设置你要登录时候用的密码的,但是 mysql 登陆的时候,他又要密码。
 
解决方法:
修改MySQL的登录设置: 
# vi /etc/my.cnf 
在[mysqld]的段中加上一句:skip-grant-tables 
例如: 
[mysqld] 
datadir=/var/lib/mysql 
socket=/var/lib/mysql/mysql.sock 
skip-grant-tables 
保存并且退出vi。 
 
 
重启mysql:
 
service mysqld stop
service mysqld start
 
 
 
 
 
 
新安装的MySQL5.7,登录时提示密码错误,安装的时候并没有更改密码,后来通过免密码登录的方式更改密码,输入update mysql.user  set password=password('root') where user='root'时提示ERROR 1054 (42S22): Unknown column 'password' in 'field list',原来是mysql数据库下已经没有password这个字段了,password字段改成了
authentication_string

所以更改语句替换为update mysql.user set authentication_string=password('root') where user='root'

原文地址:https://www.cnblogs.com/S-tec-songjian/p/5674718.html