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

An example Analysis of user Rights in the comparison between MySQL and Oracle

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

Share

Shulou(Shulou.com)05/31 Report--

The purpose of this article is to share with you the content of a sample analysis of user rights compared between MySQL and Oracle. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

User permissions

Numbered Category ORACLEMYSQL Note 1 create user Create user user_name identified by user_password

Default tablespace starSpace temporary tablespace temp;CREATE USER user_name IDENTIFIED BY user_password;1.oracle create user

There are three default users of Oracle: sys / system / scott. Sys and system are system users with dba authority, and scott user is a demonstration account of Oracle database, which is created during database installation and does not have dba authority.

Create user commands:

Create user user_name identified by user_password

[default tablespace tableSpace]

[temporary tablespace tableSpace}

Description:

Each user has a default table space and a temporary table space. If not specified, oracle sets system to the default table space and temp to the temporary table space.

2.mysql create user

Create user commands:

Mysql > CREATE USER yy IDENTIFIED BY '123'

Yy indicates the user name you want to create, followed by 123 indicates the password

The users established above can log in anywhere.

If you want to restrict login to a fixed address, such as localhost login:

Mysql > CREATE USER yy@localhost IDENTIFIED BY '123 delete 2 delete user Drop user user_name cascade;Drop user user_name;1. Oracle

SQL > drop user user name; / / user has not created any entity

SQL > drop user username CASCADE; / / Delete all users and their created entities

Note: users who are currently connected must not be deleted.

2. Mysql

Since 4.1.1, delete a MYSQL account and use the drop user statement.

However, in versions prior to 5.0.2, the drop user statement could only delete users who did not have any permissions.

From version 5.0.2 onwards, the drop user statement removes any user. Of course, you can't delete yourself. Example: drop user "garfield" @ "localhost". Don't forget to add the @ after it, or you will make a mistake.

To delete a MYSQL account in versions between 4.1.1 and 5.0.2, you need to do the following.

1) use the show grants statement to see what permissions are available for the MYSQL account to be deleted, using methods such as show grants for "garfield" @ "localhost".

2) use the permission statement to reclaim the permissions that the user has in show grants. Executing this statement deletes the relevant records in the ownership limit table except the user table and reclaims the global permissions that the user has in the user table.

3) use the drop user statement to remove the user from the user table. 3 change password alter user user_name identified by new_password

Mysqladmin-u root-p 123456 password "your password"; 1.mysql changes password

The first way:

1) change the situation where root does not have a password before

C:\ mysql\ bin > mysqladmin-u root password "your password"

2) if the root has a password before the change, if it is 123456

C:\ mysql\ bin > mysqladmin-u root-p123456 password "your password"

Note: the changed password cannot use single quotation marks, double quotation marks can be used or no quotation marks can be used

The second way:

1) c:\ mysql\ bin > mysql-uroot-p password to log in as root

2) mysql > use mysql Select Database

3) mysql > update user set password=password ('your password') where User='root'

4) mysqlflush privileges; Reload permissions Table 4 set user permissions Grant connect to star-the star role allows users to connect to the database and create database objects

The Grant resource to star-star role allows users to use storage space in the database.

Grant dba to star-- DBA permission GRANT ALL ON picture.* TO test IDENTIFIED BY "test"; 1. For more information, please see 2.1 Oracle permission Settings.

two。 For more information, please see 1.4 user Rights Settings 5 Recycling permissions Revoke select, update on product from user02;REVOKE privileges (columns) ON what FROM user1. Oracle

The basic format of the Revoke statement is as follows:

REVOKE permission type [(field list)] [, permission type [(field list)] …] ON {database name. Table name} FROM user name @ domain name or IP address

For example, the administrator revokes the permissions that user admin@localhost has on database xsxk to create, create databases and tables, and revokes the permissions that the user can grant to other users, using the following command.

Mysql > revoke create,drop on xsxk.* from admin@localhost

Mysql > revoke grant option on xsxk.* from admin@localhost

The "user name @ domain name or IP address" section of the revoke statement must match the "user name @ domain name or IP address" section of the original grant statement, and the "permission type" section can be part of the granted permissions. Moreover, revoke can only revoke permissions, cannot delete user accounts, and still keep the user's record in the authorization table user; users can still connect to the database server. If you want to delete the user completely, delete the user record from the user table using the delete statement mentioned earlier.

2. Mysql

To revoke a user's privileges, use the revoke statement. The syntax of REVOKE is very similar to the GRANT statement, except that TO is replaced by FROM and there are no INDETIFED BY and WITH GRANT OPTION clauses:

REVOKE privileges (columns) ON what FROM user

The user part must match the user part of the original GRANT statement for the user you want to revoke. The privileges part does not need to match, you can use the Grant statement to authorize, and then use the revoke statement to revoke only part of the permission.

The REVOKE statement removes only permissions, not users. Even if you revoke all permissions, the user record in the user table remains, which means that the user can still connect to the server. To delete a user completely, you must explicitly delete the user record from the user table with a Delete statement. Thank you for reading! This is the end of the article on "sample Analysis of user Rights in the comparison of MySQL and Oracle". 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, you can share it out 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

Database

Wechat

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

12
Report