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

    ubuntu自带了mysql,使用apt-get安装即可

    sudo apt-get install mysql-server
    sudo apt-get install mysql-client

    用以下命令检查MySQL是否运行:

    sudo netstat -tap | grep mysql

    我这里显示

    tcp        0      0 localhost:mysql         0.0.0.0:*                     LISTEN      6204/mysqld 

    说明安装成功。

    安装完毕以后,用以下命令登录

    mysql -u root -p

    会提示

    ERROR 1698 (28000): Access denied for user 'root'@'localhost'

    此时,打开/etc/mysql/debian.cnf文件,注意,不是mysql.cnf

    sudo vim debian.cnf

    默认的user是debian-sys-maint,maint的意思是维修、保养,mysql默认创建了一个运维角色。

    password 项后面的复杂字符串,可能是个加密串,直接修改成其它密码无效,所以,老老实实地用原来的,不过可以复制以后粘贴到需要输入密码的地方。

    mysql -u debian-sys-maint -pwg

    登录成功以后,设置root的密码,如果你用这种方式不成功:

    update mysql.user set authentication_string=password('666666') where user='root'and Host = 'localhost';

    那就试试下面这种(来自:https://www.cnblogs.com/leolztang/p/5094930.html

    update mysql.user set authentication_string=PASSWORD('666666'), plugin='mysql_native_password' where user='root';

    我用第二种方法设置成功。

    至此,ubuntu下的mysql安装完成。

  • 相关阅读:
    input file 多张图片上传 获取地址 ——fileReader
    15个常用的javaScript正则表达式
    sublime-emmet
    AMD-requireJS
    jQuery-lazyload参数
    easyui 查询条件form 数据遍历
    导出excel设置金额格式
    html5页面添加时间戳
    创建枚举
    定义实体转json需要方法
  • 原文地址:https://www.cnblogs.com/Sabre/p/10480932.html
Copyright © 2011-2022 走看看