zoukankan      html  css  js  c++  java
  • wsl中ubuntu安装mysql

    删除之前安装的

    sudo apt-get remove --purge *mysql*
    sudo rm -rf /etc/mysql /var/lib/mysql
    sudo apt-get remove --purge *mariadb*

    然后

    sudo apt update
    sudo apt upgrade

    然后

    sudo apt install mysql-server

    安装完成之后

    sudo service mysql start

    如果无法启动

    cat /var/log/mysql/error.log

    查看错误日志发现,端口被占用,所以无法启动,查找发现,wsl 的ubuntu 和 windows 是公用端口的,所以使用命令

    netstat -ano| findstr 3306
    在windwos下查看并且记下pid (最后一列),打开任务管理器,打开详细信息,关闭那个pid
     
     
     
     
     
     
     
     

     然后重新 启动mysql ,成功。

     设置新密码

    >use mysql;
    >select host,user,plugin,authentication_string from user;  #root用户的plugin为auth_socket,密码为空
    >update user set plugin="mysql_native_password",authentication_string=password('新密码') where user="root";

    刷新权限

    flush privileges;

    重新登入

    wsl,Ubuntu,关于解决E: Could not read response to hello message from hook [ ! -f /usr/bin/snap ] || /usr/

    解决方法:

    sudo rm -rf /etc/apt/apt.conf.d/20snapd.conf
  • 相关阅读:
    一些无意间YY的脑瘫题
    回滚莫队
    数论
    专题整理
    模拟赛x+1
    HISKrrr的板子库
    java多线程学习笔记(四)
    java多线程学习笔记(三)
    java多线程学习笔记(二)
    Java多线程学习笔记(一)
  • 原文地址:https://www.cnblogs.com/wangdongpython/p/12442263.html
Copyright © 2011-2022 走看看