linux centos安装mysql
2016-07-05 15:48
405 查看
linux centos安装mysql
一.mysql安装:
1.查看有没有可安装包:
yum list mysql-server
2.安装:
yum install mysql-server
二.服务操作:
1.启动服务:
service mysqld start
2.停止服务:
service mysqld stop
3.重启服务:
service mysqld restart
三.修改密码:
mysql;
update user set password=password('密码') where user='root';
flush privileges;
四.连接:
连接命令:mysql
关闭连接命令:/q
五.设置远程访问:
grant all privileges on *.* to 'root'@'%' identified by '密码' with grant option;
六.开启端口:
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
/etc/rc.d/init.d/iptables save
七.开机启动:
chkconfig mysqld on
查看启动项:
chkconfig --list
启动后如图:
(2,3,4,5)都为on
![](https://images2015.cnblogs.com/blog/598482/201607/598482-20160705154745296-1654815521.png)
八.解决乱码:
1.找一个配置文件,复制到/etc/目录,命名为my.cnf
(有时候没有my.cnf)
cp /usr/share/doc/mysql-server-5.1.73/my-medium.cnf /etc/my.cnf
2.vim my.cnf
在[client]和[mysqld]下面都添加上
default-character-set=utf8
一.mysql安装:
1.查看有没有可安装包:
yum list mysql-server
2.安装:
yum install mysql-server
二.服务操作:
1.启动服务:
service mysqld start
2.停止服务:
service mysqld stop
3.重启服务:
service mysqld restart
三.修改密码:
mysql;
update user set password=password('密码') where user='root';
flush privileges;
四.连接:
连接命令:mysql
关闭连接命令:/q
五.设置远程访问:
grant all privileges on *.* to 'root'@'%' identified by '密码' with grant option;
六.开启端口:
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
/etc/rc.d/init.d/iptables save
七.开机启动:
chkconfig mysqld on
查看启动项:
chkconfig --list
启动后如图:
(2,3,4,5)都为on
![](https://images2015.cnblogs.com/blog/598482/201607/598482-20160705154745296-1654815521.png)
八.解决乱码:
1.找一个配置文件,复制到/etc/目录,命名为my.cnf
(有时候没有my.cnf)
cp /usr/share/doc/mysql-server-5.1.73/my-medium.cnf /etc/my.cnf
2.vim my.cnf
在[client]和[mysqld]下面都添加上
default-character-set=utf8
相关文章推荐
- Linux 查看CPU信息的命令
- Linux下FILE结构体字段详解
- zabbix_agent安装(Centos+Ubuntu)
- LINUX--系列知识
- linux 管道重定向
- critical sections 临界区(危险区)
- CentOS6.6搭建LNMP环境
- [置顶] 【Linux】 进程通信--匿名管道
- Linux进程间通信
- linux下PHP7环境搭建
- Linux/Windows JDK8安装|JDK1.8安装和环境变量配置
- JDK8下载|JDK1.8下载可选择window版和linux版
- Linux vi命令使用
- Linux下安装Hadoop(2.7.1)详解及WordCount运行
- u-boot向linux内核传递启动参数
- 解决 RHEL 7/ CentOS 7/Fedora 出现Unit iptables.service failed to load
- Linux基础命令
- linux下常用命令
- linux下常用命令
- Linux性能测试 netstat命令