1. 程式人生 > >linux連線windows的資料庫

linux連線windows的資料庫

linux連線windows的資料庫

1、首先在windows上的資料庫操作;點選連線管理-->點選-->新建如果之前就有連線,只是想加入資料庫,可以匯入資料了;

2、linux上連線windows

安裝好mysql後:

[[email protected] html]# mysql -uroot -p Enter password:O#E1Bui_i(ey Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 23
Server version: 5.7.21 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

     mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'MyNewPass4!' WITH GRANT OPTION;

解釋一下:

  1. 第一個*是資料庫,可以改成允許訪問的資料庫名稱
  2. 第二個 是資料庫的表名稱,代表允許訪問任意的表
  3. root代表遠端登入使用的使用者名稱,可以自定義
  4. %代表允許任意ip登入,如果你想指定特定的IP,可以把%替換掉就可以了
  5. password代表遠端登入時使用的密碼,可以自定義
  6. flush privileges;這是讓許可權立即生效

出現這個就好了Query OK, 0 rows affected (0.00 sec)

mysql> exit;退出mysql;