zoukankan      html  css  js  c++  java
  • CentOS7 MySQL

    CentOS 7 安装MySQL服务:

    wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
    sudo rpm -ivh mysql57-community-release-el7-9.noarch.rpm
    sudo yum install mysql-server

    启动MySQL服务:

    sudo systemctl start mysqld
    sudo systemctl status mysqld

    启动时的临时密码:

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

    修改密码:

    MySQL 5.7.6及以上版本:

    ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';

    MySQL 5.7.5及以下版本:

    SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');

    忘记密码后重置密码:

    1.修改MySQL的登录设置:
    
        # vim  /etc/my.cnf 
    
        在[mysqld]的段中加上一句:skip-grant-tables 
    
        例如:
    
        [mysqld] 
    
        datadir=/var/lib/mysql 
    
        socket=/var/lib/mysql/mysql.sock 
    
        skip-grant-tables 
    
        保存并且退出
    
    2、重新启动mysql
    
        service mysql restart
    
    3、登录并修改登录密码
    
        #mysql
    
        #use mysql
    
        update user set Password=password('密码') where  user='root' ;
    
        quit;
    
    4、强配置改回来
    
       去掉 skip-grant-tables 
    
    5、重新启动mysql
    
        service mysql restart

    CentOS 7 Python安装MySQLdb模块:

    sudo yum install mysql mysql-devel mysql-lib
    sudo yum install MySQL-python
    pip install mysql-python

    参考:

    https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-centos-7

    https://stackoverflow.com/questions/4380931/installing-mysql-python-on-centos

    https://my.oschina.net/u/2297737/blog/688214

  • 相关阅读:
    HTTP RFC解析
    Symfony框架的笔记
    Swoole学习总结1
    PHP Socket 学习笔记一
    Js解决解除多次Ajax请求的事件
    Python 操作串口
    python 实现微信自动回复和好友签名分析
    杂谈1
    Vue.js 功课1
    微信API demo
  • 原文地址:https://www.cnblogs.com/followyourheart/p/mysql.html
Copyright © 2011-2022 走看看