centos mysql 安装及配置

 时间:2026-04-21 16:19:14

1、Centos 6.6下安装Mysql很简单,

yum list mysql-server

centos mysql 安装及配置

2、当只有一个时候就可以直接

yum install mysql-server

进行安装

centos mysql 安装及配置

3、过程中选择Y继续安装,最后安装成功

centos mysql 安装及配置

1、先启动Mysql服务

service mysqld start

centos mysql 安装及配置

2、连接一下试一下,直接

mysql

然后

\q

关闭连接

centos mysql 安装及配置

3、设置Mysql开机启动

chkconfig mysqld on

centos mysql 安装及配置

4、开启3306端口并保存

/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

/etc/rc.d/init.d/iptables save

centos mysql 安装及配置

1、连接mysql数据库

设置密码

use mysql;

update user set password=password('密码') where user='root';

flush privileges;

centos mysql 安装及配置

2、设置Mysql远程访问

grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;

centos mysql 安装及配置

1、找一个配置文件,复制到/etc/目录,命名为my.cnf

(有时候没有my.cnf)

cp /usr/share/doc/mysql-server-5.1.73/my-medium.cnf /etc/my.cnf

centos mysql 安装及配置

2、vim my.cnf

在[client]和[mysqld]下面都添加上

default-character-set=utf8

centos mysql 安装及配置

3、最后按Esc输入

:wq

保存退出

1、最后重新启动服务就可以了

service mysqld restart

  • linux下怎样安装pip
  • linuxmint xfce 显示不正常怎么办 分辨率不正常
  • VS2013中如何将代码自动保存为UTF8格式
  • 树莓派无显示器情况下,如何利用pc控制
  • Ubuntu 怎样卸载软件
  • 热门搜索
    发烧物理降温的方法 配方法公式 怎么减掉双下巴 生菜怎么做好吃又简单 头发怎么保养 乌龟怎么冬眠 电机型号大全 说明方法有哪些 机械表日期怎么调 炒土豆丝的家常做法