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
  • 相关阅读:
    Go:获取命令行参数
    Go:文件操作
    Go:类型断言
    GO:interface
    Go:面向"对象"
    Go:工厂模式
    layui中流加载layui.flow
    js显示当前时间
    layui中的分页laypage
    layui中的多图上传
  • 原文地址:https://www.cnblogs.com/wangdongpython/p/12442263.html
Copyright © 2011-2022 走看看