zoukankan      html  css  js  c++  java
  • linux 安装mysql及配置

    ubuntu 18.04

    1.安装

    apt-get install -y mysql-server
    

    使用上述命令即可完成mysql的安装,有些教程建议install mysql-client,实践表明,上述命令同时完成client的安装。

    安装以后,mysql是在后台运行的,可以通过service命令查看mysql的运行情况:

    service mysql status
    或者
    systemctl status mysql
    

    2.修改root的默认密码

    mysql的配置文件放在/etc/mysql目录下,具体为:

    # 查看文件目录
    root@ubuntu:/etc/mysql# ls
    conf.d  debian.cnf  debian-start  my.cnf  my.cnf.fallback  mysql.cnf  mysql.conf.d
    
    
    # 查看debian.cnf,借此登录mysql
    root@ubuntu:/etc/mysql# cat debian.cnf 
    # Automatically generated for Debian scripts. DO NOT TOUCH!
    [client]
    host     = localhost
    user     = debian-sys-maint
    password = V5kqkke6kuSbaKcj
    socket   = /var/run/mysqld/mysqld.sock
    [mysql_upgrade]
    host     = localhost
    user     = debian-sys-maint
    password = V5kqkke6kuSbaKcj
    socket   = /var/run/mysqld/mysqld.sock
    
    # 根据cnf文件信息登录mysql
    mysql -u debian-sys-maint -p
    # 输入刚刚的password
    
    # 进入mysql client,变更root密码
    show databases;
    use mysql;
    update user set authentication_string=PASSWORD("root") where user='root'; # root用户密码也是root
    update user set plugin="mysql_native_password";
    flush privileges;
    exit;
    
    
  • 相关阅读:
    联考20200520 T2 函数
    联考20200520 T1 石子游戏
    模拟赛T2 中继系统
    模拟赛T2 仙人掌毒题
    BZOJ3462 DZY Loves Math II
    20200129模拟赛T1 string
    BZOJ1316 树上的询问
    BZOJ4559 成绩比较
    JZOJ4238 纪念碑
    BZOJ 2648 世界树
  • 原文地址:https://www.cnblogs.com/davis12/p/14577246.html
Copyright © 2011-2022 走看看