zoukankan      html  css  js  c++  java
  • centOS 安装mysql

    yum list mysql-server

    当只有一个时候就可以直接
    yum install mysql-server

    先启动Mysql服务
    service mysqld start

    连接一下试一下,直接
    mysql

    然后
    q
    关闭连接

    设置Mysql开机启动
    chkconfig mysqld on

    开启3306端口并保存
    /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
    /etc/rc.d/init.d/iptables save

    连接mysql数据库
    use mysql;
    设置密码
    update user set password=password('itliucheng') where user='root';
    flush privileges;

    设置Mysql远程访问
    grant all privileges on *.* to 'root'@'%' identified by 'itliucheng' with grant option;

    解决Mysql乱码问题
    找一个配置文件,复制到/etc/目录,命名为my.cnf
    (有时候没有my.cnf)
    cp /usr/share/doc/mysql-server-5.1.73/my-medium.cnf /etc/my.cnf

    vim my.cnf
    在[client]和[mysqld]下面都添加上
    default-character-set=utf8
    最后按Esc输入
    :wq
    保存退出
    最后重新启动服务就可以了
    service mysqld restart

  • 相关阅读:
    基于bootstrap分页
    encache学习教程
    java异常和spring事务注解
    JSP自定义标签开发入门
    spring junit
    vs与数据库连接查询
    winfrom文本文档打开
    面向对象 封装
    面向对象 概念
    DW 游记代码
  • 原文地址:https://www.cnblogs.com/itliucheng/p/5072867.html
Copyright © 2011-2022 走看看