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

Some common basic operations of Linux system MySQL

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

Share

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

The following to understand some of the common basic operations of Linux system MySQL, I believe you will benefit a lot after reading, the text in the essence is not much, hope that some common basic operations of Linux system MySQL this short content is what you want.

1.create database xxx; creates a database xxx

2.use xxx; enters xxx

3.create table yyy (); create table yyyy

Formats that can be added in parentheses include int {integer variables}

Char (10) {string (length set to 10)}

Decimal (5Pol 2) (set to 5 significant digits, keep 2 decimal places)

Example:

Create table yyy (id int,name varchar (10), score decimal (5penny 2))

Insert content:

Example:

4.insert into yyy (name,score) values ('test02',60)

5.desc yyy; displays the content structure of yyy table

6.select * from yyy; displays all data in yyy

8.7.update yyy set name='zhangsan' where id=1; changed the name of id 1 to 'Zhang San'

8.delete from yyy where zzz=zzzz; removes zzz as zzz

9.drop database xxx; delete database xxx

10.drop table yyy; delete table

11.show databases; views all databases

12.show tables; view all forms

13.flush privileges; refreshes the database

-next up is user management-

Enter use mysql first

Then enter

1.select User, authentication_string,Host from user

You can view all users.

2.create user 'jerry'@'loclalhost' identified by' abc123'

Add user 'Jerry' to log in locally with the password abc123.

3.select password ('abc123'); view the ciphertext corresponding to the password abc123

4.create user 'charry'@'loclalhost' identified by' * 6691484EA6B50DDDE1926A220DA01FA9E575C18A'

Add user 'Charlie' to log in locally with a ciphertext password.

5.rename user'charry'@'localhost' to 'tom'@'localhost'

Change the local user 'Charlie' to 'Tom'

6.drop user'tom'@'localhost'

Delete the user 'Tom' locally

7.set password for 'jerry'@'localhost'= password'abc123'

Change the login password of user 'Jerry' to 'abc123''

8.grant select on xxx.yyy to 'tom'@'%' identified by' abc123'

Add the permissions of the user 'Tom' in the table yyy of the database xxx

9.revoke select on xxx.yyy from 'tom'@'%'

Delete the permissions of user 'Tom' in the table yyy of database xxx

After reading this article on some common basic operations of Linux system MySQL, many readers will certainly want to know more about it. If you need more industry information, you can follow our industry information section.

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

Wechat

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

12
Report