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 use MySQL in Linux

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article will explain in detail how to use MySQL in Linux. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

1.show databases

2.use mysql conversion database

3.show tables displays tables in the database

4.select user,host,password from user queries the user,host,password of my database mysql

5. Set a password for the account

Mysql > update user set password=password ('123456') where user='root'

6. Clear empty user

Delete From user where user=''

7. View the remaining users

Command the same query user command as above

8. Refresh permissions (focus)

Command flush privileges; to refresh permissions after each operation!

9. Access the database through the user

Mysql-u root-p123456; (all passwords after-p)

10. Edit the .bash _ profile file (this step allows us to use which mysql to directly find out where the mysql file is)

Vi . Change bash_profile to # .bash _ profile

# Get the aliases and functions

If [- f ~ / .bashrc]; then

. ~ / .bashrc

Fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

1,1 Top

# .bash _ profile

# Get the aliases and functions

If [- f ~ / .bashrc]; then

. ~ / .bashrc

Fi

# User specific environment and startup programs

Export MYSQL_BASE=/usr/local/mysql

Export PATH=$ {MYSQL_BASE} / bin:$PATH

PS1= `uname-n` ":"'$USER' ":"'$PWD' ": >"; export PS1 gets the result

11. Create a new database and set up access to his machine

11.1 create database ruozedb; create database ruozedb

11.2grant all privileges on ruozedb.* to ruoze@'192.168.137.252' identified by '123456' only users whose IP is 192.168.137.252 are allowed to access the database ruozedb with a password of 123456 (if the IP address is changed to%, any ID can be accessed by ruoze users)

11.3flush privileges; permission refresh

The practice is shown in the figure:

twelve。 Connect Dbeaver

This is the end of the article on "how to use MySQL in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

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

Internet Technology

Wechat

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

12
Report