Get the App
SLTechnology News&Howtos  ›  Database  › 

Some common basic operations of Linux system MySQL

Shulou Source: shulou.com Published: 2022-06-01 18:43:38 11月03日 Update

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.

Tags: User data database table content password Tom basic operation common system login ciphertext more permissions industry Jerry Charlie affirmative input valid Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple MariaDB Microsoft Shulou Technology Huawei