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

How to configure MariaDB password and remote access permissions for MySQL

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

Share

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

Terminology

MySQL:

MySQL is a relational database management system, originally an open source relational database management system, originally developed by Sweden's MySQL AB company, which was acquired by Shenyang Microsystems (Sun Microsystems) in 2008. In 2009, Oracle acquired Shenyang Microsystems, and MySQL became a product of Oracle.

MySQL has become the most popular open source database in the past because of its high performance, low cost and good reliability, so it is widely used in small and medium-sized websites on Internet. With the continuous maturity of MySQL, it is also gradually used in more large-scale websites and applications. The "M" in the very popular open source software combination LAMP refers to MySQL.

MariaDB:

MariaDB database management system is a branch of MySQL, which is mainly maintained by the open source community and licensed by GPL. MariaDB was developed by Michael Vidnius, the founder of MySQL, who had earlier sold his company, MySQL AB, to SUN for $1 billion, and then MySQL was owned by Oracle as SUN was acquired by Oracle. The name MariaDB comes from the name of Maria (English: Maria), daughter of Michael Vidnius. MariaDB's API and protocol are compatible with MySQL, and additional features have been added to support local non-blocking operations and progress reporting. Worried about a more closed software project of Oracle MySQL, Fedora plans to replace MySQL with MariaDB in Fedora 19, and Wikimedia Foundation servers also use MariaDB to replace MySQL.

Environment

MySQL version Server version: 5.5.64-MariaDB MariaDB Server

Linux version CentOS Linux release 7.6.1810 (AltArch)

Operation

1) by default, root logs in without a password, enter directly, enter a password, and enter directly

Root@host-172-16-61-102bin] # mysql-uroot-p

PASSWORD:

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

Your MariaDB connection id is 35

Server version: 5.5.64-MariaDB MariaDB Server

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

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

2) Select the database, otherwise there will be an error in executing the instruction No database selected

MariaDB [(none)] > use mysql

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with-A

Database changed

3) specify that the password of the root user is root

MariaDB [mysql] > update user set password=password ("root") where user='root'

Query OK, 0 rows affected (0.00 sec)

Rows matched: 5 Changed: 0 Warnings: 0

Note:

If the execution is invalid, it may be the version. Check to see if the password is saved in the password field or the authentication_string field.

Update user set password = password ("root"), authentication_string=password ("root") where user=root

You can view the table structure of the current user by directing desc user

4) Grant access

Root users connect to the mysql server from any host using a password

MariaDB [mysql] > GRANT ALL PRIVILEGES ON *. * TO 'root'@'%' IDENTIFIED BY' root' WITH GRANT OPTION

The BY is followed by the password of the root user: root

Only 192.168.10.168 is allowed to connect to the mysql server through root users

GRANT ALL PRIVILEGES ON *. * TO 'root'@'192.168.10.168' IDENTIFIED BY' root' WITH GRANT OPTION

5) refresh permissions

MariaDB [mysql] > flush privileges

Query OK, 0 rows affected (0.00 sec)

Note:

1) Navicat remote login failed

1045-Access denied for user 'root@192.168.63.184' (using password: YES)

The grant of access is not performed. Perform step 4.

You can check whether you have permission for remote access by instructing select host,user from user;

2) turn off the firewall

Systemctl stop firewalld.service # stop firewall

Systemctl disable firewalld.service # prevents firewall from booting

Open the port

Firewall-cmd-zone=public-add-port=3306/tcp-permanent

The mysql service is started, which can be used to listen to whether or not to listen through port 3306 of lsof-i.

Restart the firewall

Firewall-cmd-reload

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

Database

Wechat

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

12
Report