• centos6.9安装MySQL5.6.44


    一、检查系统是否安装其他版本的MYSQL数据
    1 # yum list installed | grep mysql
    2 # yum -y remove mysql-libs.x86_64
    二、安装及配置
    1 # wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
    2 # rpm -ivh mysql-community-release-el6-5.noarch.rpm
    3 # yum repolist all | grep mysql
    安装MYSQL数据库
    1 # yum install mysql-community-server -y
    设置为开机启动(2、3、4都是on代表开机自动启动)
    1 # chkconfig --list | grep mysqld
    2 # chkconfig mysqld on
    三、设置远程root
    启动mysql
    1 # service mysqld start
    设置root密码
    1 # mysql_secure_installation
    登录root账号
    1 # mysql -uroot -p 
    建立远程root用户
    1 mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你设置的密码' WITH GRANT OPTION;
    2 mysql> flush privileges;
    四、设置utf-8编码
    查看mysql原本编码:
    1 mysql> show variables like 'character%';
    设置编码 vi /etc/my.cnf
     1 [mysqld]
     2 character-set-server=utf8 
     3 collation-server=utf8_general_ci 
     4 performance_schema_max_table_instances=400 
     5 table_definition_cache=400 
     6 table_open_cache=256
     7 # 修改
     8 sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
     9 
    10 [mysql]
    11 default-character-set = utf8
    12 
    13 [mysql.server]
    14 default-character-set = utf8
    15 
    16 
    17 [mysqld_safe]
    18 default-character-set = utf8
    19 
    20 
    21 [client]
    22 default-character-set = utf8

    重启mysql

    1 # service mysqld restart

    再次查看编码:

     1 mysql> show variables like 'character%';
     2 +--------------------------+----------------------------+
     3 | Variable_name | Value |
     4 +--------------------------+----------------------------+
     5 | character_set_client | utf8 |
     6 | character_set_connection | utf8 |
     7 | character_set_database | utf8 |
     8 | character_set_filesystem | binary |
     9 | character_set_results | utf8 |
    10 | character_set_server | utf8 |
    11 | character_set_system | utf8 |
    12 | character_sets_dir | /usr/share/mysql/charsets/ |
    13 +--------------------------+----------------------------+
    14 8 rows in set (0.00 sec)
  • 相关阅读:
    谈谈程序员、技术主管和架构师
    PyPI教程
    python以下划线开头的变量和函数的作用
    csv和xlsx区别
    编码问题2 utf-8和Unicode的区别
    编码问题1
    洛谷 1404 平均数
    洛谷 1441 砝码秤重
    【模板】高斯消元法
    线段树练习题
  • 原文地址:https://www.cnblogs.com/pan-louis/p/11004087.html
Copyright © 2020-2023  润新知