Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Proxy server network environment Ubuntu installs MariaDB and MySQL

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Proxy Server IP: 10.0.0.10

Ubuntu Server IP: 10.0.0.11

Window PC IP: 10.0.0.12

Log in to the Ubuntu server or use Putty to log in remotely.

Last login: Mon Dec 30 04:15:26 2019 from 10.0.0.12

Second, check IP, DNS settings, confirm that you can connect to the network, you can directly jump to the fourth step.

paul@ubuntu1804:~$ ping www.163.com

ping: www.163.com: Temporary failure in name resolution

I am here because in the virtual machine network 10.0.0.0/24 is through the proxy server Internet, first have to set up the proxy in Ubuntu, plus the last three configuration files.

paul@ubuntu1804:~$ sudo vim /etc/environment

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"

http_proxy=http://10.0.0.10:3128/

https_proxy=https://10.0.0.10:3128/

no_proxy="localhost,127.0.0.1,::1"

Then check to see if wget is installed.

paul@ubuntu1804:~$ sudo dpkg -s wget

Package: wget

Status: install ok installed

Query installed, otherwise use sudo apt -y install wget to install, and then wget to test if you can connect to the Internet

paul@ubuntu1804:~$ sudo wget yahoo.com

URL transformed to HTTPS due to an HSTS policy

--2019-12-30 06:01:28-- https://yahoo.com/

Connecting to 10.0.0.10:3128... connected.

Proxy request sent, awaiting response... 301 Moved Permanently

Location: https://www.yahoo.com/ [following]

--2019-12-30 06:01:29-- https://www.yahoo.com/

Connecting to 10.0.0.10:3128... connected.

Proxy request sent, awaiting response... 200 OK

Length: unspecified [text/html]

Saving to: 'index.html'

index.html [ ] 334.26K 59.0KB/s in 6.0s

2019-12-30 06:01:35 (55.4 KB/s) - 'index.html' saved [342281]

paul@ubuntu1804:~$ ls

index.html

3. You can only modify the proxy of apt, refer to the writing at the end of the text.

paul@ubuntu1804:~$ cd /etc/apt/apt.conf.d/

paul@ubuntu1804:/etc/apt/apt.conf.d$ sudo touch proxy.conf

[sudo] password for paul:

paul@ubuntu1804:/etc/apt/apt.conf.d$ sudo vim proxy.conf

Acquire::http::Proxy "http://10.0.0.1:3128/";

Acquire::https::Proxy "http://10.0.0.1:3128/";

Now ready to install the database server, first query whether there is mariadb installation package.

paul@ubuntu1804:/etc/apt/apt.conf.d$ sudo apt search mariadb

Sorting... Done

Full Text Search... Done

......

mariadb-server/bionic-updates,bionic-security 1:10.1.43-0ubuntu0.18.04.1 all

MariaDB database server (metapackage depending on the latest version)

mariadb-server-10.1/bionic-updates,bionic-security 1:10.1.43-0ubuntu0.18.04.1 amd64

MariaDB database server binaries

......

We see mariadb-server and mariadb-server-10.1 and start installing mariadb-server.

paul@ubuntu1804:/etc/apt/apt.conf.d$ sudo apt -y install mariadb-server

……

5. After installation, log in to the database with the default root account, and there is no password by default.

paul@ubuntu1804:~$ sudo mysql -u root

Welcome to the MariaDB monitor. Commands end with ; or \g.

Your MariaDB connection id is 41

Server version: 10.1.43-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Check out which databases are available.

MariaDB [(none)]> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| performance_schema |

+--------------------+

3 rows in set (0.00 sec)

Now let's create a database demo.

MariaDB [(none)]> create database demo;

Query OK, 1 row affected (0.01 sec)

MariaDB [(none)]> show databases;

+--------------------+

| Database |

+--------------------+

| demo |

| information_schema |

| mysql |

| performance_schema |

+--------------------+

4 rows in set (0.00 sec)

Then set up an account to manage the demo database, allowing it to connect remotely on the 10.0.0.0 network with the password Admin@123.

MariaDB [(none)]> GRANT ALL ON demo.* to sqladm@'10.0.0.% ' IDENTIFIED BY 'Admin@123' WITH GRANT OPTION;

Query OK, 0 rows affected (0.00 sec)

Refresh permissions.

MariaDB [(none)]> flush privileges;

Query OK, 0 rows affected (0.00 sec)

Exit the database root account.

MariaDB [(none)]> exit

Bye

7. Then we install MySQL Workbench on Win10 computer and remotely manage this database with graphical management tools. After installation, try to connect to the database on server 10.0.0.11 using the username and password you created, but you cannot connect.

Check mariaDB's service configuration file. There is a bind-address = 127.0.0.1 in it, which means only local connections are allowed. Let's comment this out.

paul@ubuntu1804:~$ cd /etc/mysql/mariadb.conf.d/

paul@ubuntu1804:/etc/mysql/mariadb.conf.d$ sudo vim 50-server.cnf

……

# bind-address = 127.0.0.1

Then restart the mariadb service, which is not mariadb, but mysqld, otherwise it will prompt no service.

paul@ubuntu1804:/etc/mysql/mariadb.conf.d$ systemctl status mysqld

8, try again to connect, still can not, we look at ubuntu 1804 firewall, it is not using iptables and firewalld, but ufw, we stop ufw service.

If you are using Redhat firewall version 7.0 or above, firewalld, please check other versions by yourself.

Note: Stop firewall only for test. After successful test of production server, modify firewall rules to allow MySQL remote connection and turn on firewall.

paul@ubuntu1804:/etc/mysql/mariadb.conf.d$ systemctl status ufw

● ufw.service - Uncomplicated firewall

Loaded: loaded (/lib/systemd/system/ufw.service; enabled; vendor preset: enabled)

Active: active (exited) since Mon 2019-12-30 05:39:26 UTC; 54min ago

paul@ubuntu1804:/etc/mysql/mariadb.conf.d$ systemctl stop ufw

Check service status again.

paul@ubuntu1804:/etc/mysql/mariadb.conf.d$ systemctl status ufw

Active: inactive (dead)

9. Click Test Connection again in MySQL Workbench.

Connection test successful.

Ten, you can double-click this connection to enter the graphical interface management MariaDB, which can intuitively see the system status.

=================================================================

Attachment: APT proxy settings file can also be written as follows:

Acquire {

HTTP::proxy "http://10.0.0.10:3128";

HTTPS::proxy "http://10.0.0.10:3128";

}

https://www.serverlab.ca/tutorials/linux/administration-linux/how-to-set-the-proxy-for-apt-for-ubuntu-18-04/

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report