• install mysql in centos and change passoword


    1- new mysql

    installing mysql by mysql-server

    yum install mysql-server
    

    starting mysql

    systemctl start mysqld
    systemctl status mysqld
    

    changing password for root

    cat /var/log/mysqld.log|grep 'temporary password'
    
    2016-12-01T00:22:31.416107Z 1 [Note] A temporary password is generated for root@localhost: mqRfBU_3Xk>r
    
    mysql -u root -p
    
    then use the password mqRfBU_3Xk>r
    
    ALTER USER 'root'@'localhost' IDENTIFIED BY 'password'; 
    

    given grant to root

    GRANT INSERT, SELECT, DELETE, UPDATE ON *.* TO 'root'@'%';
    

    if create a common user, below:

    CREATE USER 'common'@'%' IDENTIFIED BY 'password';
    

    2- old mysql

    installing mysql locally

    wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
    md5sum mysql57-community-release-el7-9.noarch.rpm
    rpm -ivh mysql57-community-release-el7-9.noarch.rpm
    config && make && make install 
    

    changing password

    • edit /etc/my.conf
    [mysqld]
    skip-grant-tables
    
    • inside mysql
    # mysql -u root
    mysql> use mysql;
    mysql> update mysql.user set authentication_string=password('123') where user='root';
    mysql> flush privileges;
    mysql> exit
    
  • 相关阅读:
    OWNER:Java配置文件解决方案 使用简介
    验证数字最简单正则表达式大全
    使用Spring进行统一日志管理 + 统一异常管理
    SpringMVC 拦截器
    Java排序
    tomcat编码配置
    日常任务
    netty入门代码学习
    redis学习
    AutoLayout And Animation
  • 原文地址:https://www.cnblogs.com/otfsenter/p/9092137.html
Copyright © 2020-2023  润新知