1. Install
Devadm @ devserver :~ $ Sudo apt-get install mysql-server ...... The following NEW packages will be installed: Libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient16 Libnet-daemon-perl libplrpc-perl mysql-client-5.1 mysql-client-core-5.1 Mysql-common mysql-server mysql-server-5.1 mysql-server-core-5.1 0 upgraded, 12 newly installed, 0 to remove and 1 not upgraded. Need to get 23.8 MB of archives. After this operation, 61.2 MB of additional disk space will be used. Do you want to continue [Y/n]? ...... [Mysql root Password: www.bkjia.com] ...... |
2. Server Configuration
1) edit the configuration file
Devadm @ devserver :~ $ Sudo vim/etc/mysql/my. cnf |
Replace 'Bind-address = 127.0.0.1 ':
Bind-address = 0.0.0.0
2) firewall, don't forget the firewall!
Devadm @ devserver :~ $ Sudo ufw allow mysql Rule added Rule added (v6) Devadm @ devserver :~ $ Devadm @ devserver :~ $ Sudo ufw status Status: active To Action From ------------ 22/tcp ALLOW Anywhere 139/tcp ALLOW Anywhere 445/tcp ALLOW Anywhere 8080/tcp ALLOW Anywhere 3306 ALLOW Anywhere 22/tcp ALLOW Anywhere (v6) 139/tcp ALLOW Anywhere (v6) 445/tcp ALLOW Anywhere (v6) 8080/tcp ALLOW Anywhere (v6) 3306 ALLOW Anywhere (v6)
Devadm @ devserver :~ $ |
3) Local Connection to configure the user and user database
Devadm @ devserver :~ $ Mysql-h 127.0.0.1-u root-p Enter password: Welcome to the MySQL monitor. Commands end with; or \ g. Your MySQL connection id is 43 Server version: 5.1.58-1Ubuntu1 (Ubuntu)
Copyright (c) 2000,201 0, Oracle and/or its affiliates. All rights reserved. This software comes with absolutely no warranty. This is free software, And you are welcome to modify and redistribute it under the GPL v2 license
Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.
Mysql> create database devcom; Mysql> create user dev; Mysql> grant all privileges on devcom. * TO 'dev' @ '% '; Mysql> set password for 'dev' @ '%' = PASSWORD ('mylittlesecret '); Mysql> Mysql> quit; Bye Devadm @ devserver :~ $ |
3. Client
1) install mysql-client
Gt @ gt-Dell :~ $ Sudo apt-get install mysql-client
Connect, create a user table, and insert Test Data
Gt @ gt-Dell :~ $ Mysql-h devserver-u dev-p Enter password: Welcome to the MySQL monitor. Commands end with; or \ g. Your MySQL connection id is 39 Server version: 5.1.58-1ubuntu1 (Ubuntu)
Copyright (c) 2000,201 0, Oracle and/or its affiliates. All rights reserved. This software comes with absolutely no warranty. This is free software, And you are welcome to modify and redistribute it under the GPL v2 license
Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.
Mysql> Mysql> USE devcom \ Database changed Mysql> create table devuser (dev_id int, dev_name char (20 )); Mysql> insert into devuser (dev_id, dev_name) VALUES (1001, 'pan black '); Query OK, 1 row affected (0.00 sec)
Mysql> SELECT * from devuser; ERROR 1146 (42S02): Table 'devcom. devuser' doesn' t exist Mysql> SELECT * FROM devuser; + -------- + ----------- + | Dev_id | dev_name | + -------- + ----------- + | 1001 | Pan Black | + -------- + ----------- + 1 row in set (0.00 sec)
Mysql> |
2) the MySQL Administrator graphical tool is available in the Ubuntu Software Center ".
650) this. width = 650; "border = 0>
After installation, go to "Application-programming-MySQL Administrator", and "Application-programming-MySQL Query Browser"