zoukankan      html  css  js  c++  java
  • install mysql on centos

    wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

    rpm -ivh mysql-community-release-el7-5.noarch.rpm

    yum install mysql-community-server
     
    service mysqld restart

    # mysql -u root

    mysql> set password for 'root'@'localhost' = password('mypasswd');

    或者:ALTER user 'root'@'localhost' IDENTIFIED BY 'mypasswd'

    mysql> exit
    -----------------------------------------

    如果忘了初始密码,

    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    可以在日志文件中找到初始密码:

    grep 'temporary password' /var/log/mysqld.log

    然后修改登录mysql并修改root密码:

    ALTER user 'root'@'localhost' IDENTIFIED BY 'XXXXXX';

    update mysql.user set host='%' where user ='root';

    ALTER user 'root'@'%' IDENTIFIED BY 'XXXXXX';
    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION;
    FLUSH PRIVILEGES;

    --mysql8.0要修改密码加密规则

    update mysql.user set plugin='mysql_native_password', authentication_string='' where user='root';
    ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'XXXXXX';

    重启MySQL

    service mysqld restart

    防火墙开放端口:
    firewall-cmd --permanent --zone=public --add-port=3306/tcp
    firewall-cmd --reload

     ---------------------------------------

    修改mysql默认字符集

    1、  处理mysql的字符集,通过show variables like 'character%';命令确认。

    vim /etc/my.cnf

    [mysqld]

    character-set-server=utf8

    default-time-zone='+08:00'

    [mysql]

    default-character-set=utf8

    然后重启mysql:service mysqld restart

  • 相关阅读:
    Plahte
    Sound 静音问题
    【模板】线段树 2
    winform GDI基础(四)简单截屏
    winform GDI基础(二)画带圆角的矩形框
    winform GDI基础(三)实现画笔
    winform GDI基础(一)
    winform播放视频(windows media player)
    c# 锁的使用
    C#Task学习
  • 原文地址:https://www.cnblogs.com/lavezhang/p/5309775.html
Copyright © 2011-2022 走看看