CentOS6.8 安装配置Mysql
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了CentOS6.8 安装配置Mysql,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1914字,纯文字阅读大概需要3分钟。
内容图文
![CentOS6.8 安装配置Mysql](/upload/InfoBanner/zyjiaocheng/883/4952dae483c64286a978e181d6b6a5f7.jpg)
1、下载mysql的repo源
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
2、安装mysql-community-release-el7-5.noarch.rpm包
rpm -ivh mysql-community-release-el7-5.noarch.rpm
安装这个包后,会获得两个mysql的yum repo源:
/etc/yum.repos.d/mysql-community.repo和 /etc/yum.repos.d/mysql-community-source.repo。
安装 yum install mysql-server
若报错:
解决办法:1、vi mysql-community.repo
2、找到mysql-56-community,
将enable置为0 enable=0;
并
重新安装? ? yum install mysql-server
3、字符集配置(/etc/my.cnf)
在[mysqld]节点下添加
default-character-set=utf8
character-set-server=utf8
保存退出:wq
4、中文乱码配置,windos下配置my.ini
(1)在5.1版本时,my.ini内【mysql】和【mysqld】中都写:
default-character-set=utf8
(2)而在5.5版本,【mysql】内这么写,【mysqld】内不能,而是:
character-set-server=utf8
5、自启动配置
(1)执行chkconfig mysqld on
(2)执行chkconfig --list mysqld(查看2-5位为on,即为ok)
6、防火墙配置
(1)sudo vi /etc/sysconfig/iptables
(2)-A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT 添加到里面
(3)重启防火墙 service iptables restart
7、重启mysql service mysqld restart
8、用户配置
(1)查看当前用户 select user,host,password from mysql.user;
(2)删除匿名用户 delete from mysql.user where user="";
(3)为root设置密码 set password for root@localhost=password('yourpassword');
(4)添加用户 insert into mysql.user(host,user,password) values('localhost','yourUserName',password('yourpassword'));
(5)创建库 create database `databaseName` default character set utf8 collate utf8_general_ci;
(6)本地用户赋予所有的权限
grant all privileges on databaseName.* to yourusername@localhost identified by `yourpassword`;
给账号开通外网所有的权限。
grant all privileges on databaseName.* to yourusername@'%' identified by `yourpassword`;
结合实际情况决定开通什么权限!!!
grant select,insert,update on databaseName.* to yourusername@'192.168.10.205' identified by `yourpassword`;
(7)使操作生效 flush privileges;
内容总结
以上是互联网集市为您收集整理的CentOS6.8 安装配置Mysql全部内容,希望文章能够帮你解决CentOS6.8 安装配置Mysql所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。