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

MySQL 8.0.18 adds authentication plug-in-Unix So

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

Share

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

The unix_socket authentication plug-in allows users to use the operating system's credentials when connecting to MariaDB through a local Unix socket file.

Popular is to use the account of the Linux operating system to log in to the MariaDB/MySQL database.

This feature was added in MariaDB 10.4.6 and is currently supported in MySQL 8.0.18.

Usage:

1. Install the plug-in

Mysql > INSTALL PLUGIN auth_socket SONAME 'auth_socket.so';Query OK, 0 rows affected (0.01 sec)

2. Create a database account hechunyang

Mysql > CREATE USER 'hechunyang'@'localhost' IDENTIFIED WITH auth_socket;Query OK, 0 rows affected (0.00 sec)

3. Create an operating system account hechunyang

# useradd hechunyang

# passwd hechunyang

Log in to the operating system as a hechunyang user

4. Log in to MySQL 8.0.18

[root@localhost soft] # su-hechunyangLast login: Fri Nov 8 16:40:53 CST 2019 on pts/0 [hechunyang@localhost ~] $[hechunyang@localhost] $[hechunyang@localhost ~] $/ usr/local/mysql/bin/mysql-S / tmp/mysql_hcy.sock-uhechunyang-e "select version () "+-+ | version () | +-+ | 8.0.18 | +-+ [hechunyang@localhost ~] $

In this example, user hechunyang is logged into the operating system and has full shell access. He has authenticated using the operating system, and his MySQL account has been configured to use the unix_socket authentication plug-in, so he does not need to authenticate the database again. MySQL accepts his operating system credentials and allows him to connect.

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