mysql5.7数据库安装和配置

1、查询系统默认mysql版本,默认版本一般情况下我5.1

rpm -qa |grep mysql


2、卸载默认mysql

yum remove mysql


3、yum安装mysql5.7

wget  http://dev.mysql.com/get/mysql57-community-release-el6-8.noarch.rpm   --no-check-certificate
yum localinstall mysql57-community-release-el6-8.noarch.rpm
yum install mysql-server
service mysqld stop && service mysqld start


4、找到密码,并且修改密码

grep "password" /var/log/mysqld.log
mysqladmin -uroot -p password


5、开启远程访问

mysql -u root -p
use mysql
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Codyy@2506' WITH GRANT OPTION;
flush privileges;


6、开启防火墙3306端口


7、扩展:

修改mysql配置表名不区分大小写

在 /etc/my.cnf 添加如下配置:
lower_case_table_names=1
skip-name-resolve
然后重启mysql: service mysqld restart




错误解决:

错误显示:


软件包:mysql-community-server-5.7.20-1.el6.x86_64 (mysql57-community)


需要:libsasl2.so.2()(64bit)


您可以尝试添加 --skip-broken 选项来解决该问题


您可以尝试执行:rpm -Va --nofiles --nodigest


解决方法:


修改vim /etc/yum.repos.d/mysql-community.repo 源文件


[mysql57-community]


name=MySQL 5.7 Community Server


## baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/   


baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/


enabled=1


gpgcheck=0


gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql   


暂无评论