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

Detailed steps of creating tables in mysql

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

Share

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

This article mainly gives you a brief introduction to the detailed steps of mysql table building. You can look up the relevant professional terms on the Internet or find some related books to supplement them. We will not dabble here. Let's go straight to the topic. I hope this article on the detailed steps of mysql table building can bring you some practical help.

1. New user

1234567891011121314 MYSQL@ > mysql-u root-p @ > password / / create user mysql > insert into mysql.user (Host,User,Password) values ('localhost','tanzuai',password (' 123456')); / / refresh the system permissions table mysql > flush privileges; thus creating a user named: tanzuai password: 123456. / / after logging out, log in to mysql > exit;@ > mysql-u tanzuai-p @ > enter password mysql > login succeeded

two。 Authorize the user

123456789101112131415 sign in to MYSQL (with ROOT permission). I log in as ROOT. @ > mysql-u root-p @ > password / / first create a database for the user (tanzuaidb) mysql > create database tanzuaidb;// authorized jeecn user to have all the permissions of the jeecn database @ > grant all on tanzuaidb.* to tanzuai@localhost identified by '123456 permissions / refresh the system permissions table mysql > flush privileges Mysql > other actions / / if you want to assign partial permissions to a user, you can write: mysql > grant select,update on tanzuaidb.* to tanzuai@localhost identified by 123456 / refresh the system permissions table. Mysql > flush privileges

Mysql > grant permission 1, permission 2, … Permission n on database name. Table name to user name @ user address identified by 'connection password'

Permission 1, permission 2,... Permission n represents 14 permissions such as select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file.

When permission 1, permission 2,... Permission n is replaced by all privileges or all, which means that the user is given full permissions.

When the database name. The table name is replaced by *. *, which means that the user is given permission to operate all tables in all databases on the cloud server.

The user address can be localhost, ip address, machine name, domain name. You can also use'%'to indicate a connection from any address.

The connection password cannot be empty, otherwise the creation fails

For example:

Mysql > grant select,insert,update,delete,create,drop on vtdc.employee to tanzuai@10.163.225.87 identified by '123'

Assign the user tanzuai from 10.163.225.87 the right to select,insert,update,delete,create,drop and other operations on the employee table of the database vtdc, and set the password to 123

Mysql > grant all on vtdc.* to tanzuai@10.10.10.87 identified by '123'

Assign the user tanzuai from 10.163.225.87 the permission to perform all operations on all tables in the database vtdc, and set the password to 123

Mysql > grant all on *. * to tanzuai@10.10.10.87 identified by '123'

Assign user tanzuai from 10.163.225.87 to perform all operations on all tables in all databases, and set the password to 123

Mysql > grant all privileges on *. * to tanzuai@localhost identified by '123'

Assign the local user tanzuai permission to perform all operations on all tables in all databases and set the password to 123.

3. Delete user

123456@ > mysql-u root-p @ > password mysql > DELETE FROM user WHERE User= "jeecn" and Host= "localhost"; mysql > flush privileges;// delete the user's database mysql > drop database tanzuaidb

4. Modify the specified user secret

12345 @ > mysql-u root-p @ > password mysql > update mysql.user set password=password ('new password') where User= "tanzuai" and Host= "localhost"; mysql > flush privileges;mysql > quit

5. Build a table

12345678create table receive_user (waybillno varchar (20) not null check (Waybillnows)), model varchar (20) not null,userid varchar (20) not null,create_time datetime default null,primary key (waybillno)) engine=InnoDB default charset=utf8 auto_increment=1

Mysql table building detailed steps to tell you here, for other related issues you want to know can continue to pay attention to our industry information. Our section will capture some industry news and professional knowledge to share with you every day.

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