CentOS下MySQL的安装和配置
来源:互联网 发布:文明6mac破解版 编辑:程序博客网 时间:2024/05/17 22:20
1.
首先将yum源改为阿里云的源
具体步骤在这里http://mirrors.aliyun.com/help/centos
2.
通过yum安装MySQL
sudo yum -y install mysql-server
检查安装版本
rpm -qa | grep mysql-server
完全卸载yum方式安装的MySQL
1、sudo yum remove mysql mysql-server mysql-libs compat-mysql51
2、sudo rm -rf /var/lib/mysql3、sudo rm /etc/my.cnf
查看是否还有mysql
rpm -qa|grep mysqldql-select
dml-insert update delete
ddl-create table credate view
dcl-grant
3.
安装完成之后,进入默认安装路径修改my.cnf配置修改字符集为utf-8
sudo vim /etc/my.cnf
添加default-character-set = utf8之后保存退出
设置MySQL随系统启动
sudo chkconfig mysqld on
修改防火墙设置
sudo vim /etc/sysconfig/iptables
添加3306端口
A INPUT -p TCP -m state --state NEW -m tcp --dport 3306 -j ACCEPT
记得添加在-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT下面
重启防火墙
sudo service iptables restart
4
添加用户
insert into mysql.user(Host,User,Password) values("localhost","user",password("user"));
查看用户
select user,host,password from mysql.user;
创建新表
create database `student` default character set utf8 collate utf8_general_ci;
5
赋予用户权限
mysql>grant select,insert,update,delete,create,drop on vtdc.employee to joe@10.163.225.87 identified by ‘123′;
给来自10.163.225.87的用户joe分配可对数据库vtdc的employee表进行select,insert,update,delete,create,drop等操作的权限,并设定口令为123。
mysql>grant all privileges on vtdc.* to joe@10.163.225.87 identified by ‘123′;
给来自10.163.225.87的用户joe分配可对数据库vtdc所有表进行所有操作的权限,并设定口令为123。
mysql>grant all privileges on *.* to joe@10.163.225.87 identified by ‘123′;
给来自10.163.225.87的用户joe分配可对所有数据库的所有表进行所有操作的权限,并设定口令为123。
mysql>grant all privileges on *.* to joe@localhost identified by ‘123′;
给本机用户joe分配可对所有数据库的所有表进行所有操作的权限,并设定口令为123。
赋予完毕之后刷新
flush privileges;
6
修改密码
set password for root@localhost=password('root');
删除用户
drop user 用户名@‘%’
drop user 用户名@localhost
- CentOS下MySQL的安装和配置
- mysql在centos下的安装和配置
- centos下mysql的安装与配置
- CentOS下Mysql的安装与配置
- centOS下安装配置mysql
- centos下mysql安装配置
- centOS 下安装配置mysql
- CentOS下安装配置MySQL
- centos 下 mysql 安装配置
- Centos 下安装配置 MySQL
- Centos下telnet的安装和配置
- Centos下telnet的安装和配置
- Centos下telnet的安装和配置
- Centos下telnet的安装和配置
- Centos下telnet的安装和配置
- Centos下webmin的安装和配置
- Centos下telnet的安装和配置
- Centos下telnet的安装和配置
- 剑指offer——高质量代码
- SSM整合之高级参数绑定
- 一些小东西
- C++中的复数Complex类
- 目前为止最全的微信小程序项目实例
- CentOS下MySQL的安装和配置
- C#之玩转反射
- CF #421 B. Mister B and Angle in Polygon
- 关于容联云通讯的使用
- 命名冲突
- ARM linux kernel启动流程 head.S(一)
- git撤销本地提交
- synchronized的几个注意事项
- 深度学习在医学图像处理中的应用