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

A simple method of quickly logging in MySQL Database without password under shell

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

The following is mainly to bring you a simple way to quickly log in to the shell database without a password. I hope that the simple way to log in to the database without a password under shell can bring you practical use, which is also the main purpose of my editing this article. All right, don't talk too much nonsense, let's just read the following.

When we want to log in to the MySQL database through mysql-client under Shell, we always have to enter the password again and again.

Usually we log in like this when we log in to the database, as follows

Root@test:~# mysql-uroot-pEnter password:

How to use the input: mysql to log in directly?

Log in quickly using .my.cnf

Create a new .my.cnf file in the ~ / directory. Of course, if you already have this file, you can modify it directly!

I personally like to use the vim method, so we can do this.

Vim / .my.cnf

Then write the following information in the file

[client] password=passworduser=username

Note: since your password is clearly written in the .my.cnf file, you should pay attention to setting the file permissions for this file.

Root@test:~# chmod 400 ~ / .my.cnf

After saving, we can log in to the MySQL database directly using the mysql command.

For the above about shell password-free quick login to MySQL database simple method, we do not think it is very helpful. If you need to know more, please continue to follow our industry information. I'm sure you'll like it.

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