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

    1. 安装mysql服务器、客户端及客户端开发工具

    sudo apt install mysql-server mysql-client libmysqlclient-dev
    

    2.设置远程访问mysql

    sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf

    注释掉bind-address = 127.0.0.1这一行,保存退出编辑

    mysql -u root -p
    

    进入mysql服务,输入如下命令允许任何机器访问mysql服务器:

    法一:修改权限法:

    mysql> grant all privileges on *.* to 'root'@'%' identified by 'mypassword' with grant option; 
    mysql> flush privileges;

    法二:修改表法:

    mysql> select host,user from user;

    结果如下:

    mysql> select host,user from user;
    +-----------+------------------+
    | host | user |
    +-----------+------------------+
    | localhost | debian-sys-maint |
    | localhost | mysql.session |
    | localhost | mysql.sys |
    | localhost | root |
    +-----------+------------------+
    4 rows in set (0.01 sec)

    将user为root的用户的host改为%:

    mysql> update user set host='%' where user='root';

    再次查询结果如下:

    mysql> select host,user from user;
    +-----------+------------------+
    | host      | user             |
    +-----------+------------------+
    | %         | root             |
    | localhost | debian-sys-maint |
    | localhost | mysql.session    |
    | localhost | mysql.sys        |
    +-----------+------------------+
    4 rows in set (0.00 sec)

    使修改生效:

    mysql> flush privileges;

    3.使用mysql客户端gui工具(navicat)连接mysql服务

  • 相关阅读:
    [转]趣题:一个n位数平均有多少个单调区间?---- From Matrix67
    2015编程之美复赛
    Codeforces Round #304 (Div. 2)
    HDU 5226
    HDU 5225
    HDU 3666
    HDU 4598
    Codeforces Round #303 (Div. 2) E
    编程之美初赛第二场AB
    2015 编程之美初赛第一场 AC题
  • 原文地址:https://www.cnblogs.com/ziyu-trip/p/9528821.html
Copyright © 2011-2022 走看看