zoukankan      html  css  js  c++  java
  • ubuntu安装MySql 并配置密码

    1.安装

    sudo apt update
    sudo apt install mysql-server

    安装后进不去

     重启mysql服务后成功进入

    2.重启mysql服务后登录(不需要密码)

    service mysql restar
    mysql -h localhost -u root

    3.修改密码(第一次不修改了再退出 之后就登不上了)

    (1)第一次尝试

    update mysql.user set password=password('root') where user='root' ;   

    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('root') where user='root'' at line 1
    mysql> update mysql.user set password=password('root') where user='root' ;

     

     然后试一下

    select password from user;

    ERROR 1054 (42S22): Unknown column 'password' in 'field list'

    原因是password字段名改为 authentication_string 了

    (2)第二次尝试

    update mysql.user set authentication_string=password('root') where user='root' ;

    ERROR 1064 (42000) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘password(‘123456’)’ at line 1

     (3)又重新搜了一下,第三次尝试

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

    或者

    SET PASSWORD = '123456'

    4.退出后快乐重新输入密码进入

  • 相关阅读:
    安装AD域时,出现NetBIOS名称冲突?
    SharePoint Server 2010 安装图解
    Visual C++ 2011519
    Visual C++ 2011520
    Visual C++ 2011518
    Visual C++ 2011520
    设计模式创建型 C++版本
    线程条件变量,一次性初始化
    Visual C++ 2011526
    Visual C++ 2011512
  • 原文地址:https://www.cnblogs.com/cxl-blog/p/13863047.html
Copyright © 2011-2022 走看看