Get the App
SLTechnology News&Howtos  ›  Database  › 

How to add multiple users and databases for mysql

Shulou Source: shulou.com Published: 2022-05-31 18:48:20 09月30日 Update

This article focuses on "how to add multiple users and databases to mysql". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to add multiple users and databases to mysql.

# vi mysqlusers.txt

Create database dataname

Grant all privileges on dataname.* to username@localhost identified by 'password'

Flush privileges

# / usr/local/mysql/bin/mysql-u root-p password

< mysqlusers.txt    蓝色斜体部分为对应的用户名和密码,添加多个用户及,只需要复制中间部分代码并修改对应的位置即可,如:    create database dataname1;    grant all privileges on dataname1.* to username1>

@ localhost "identified by 'password'

Flush privileges

Create database dataname2

Grant all privileges on dataname2.* to username2 > @ localhost "identified by 'password'

Flush privileges

At this point, I believe you have a deeper understanding of "how to add multiple users and databases for mysql". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: User data database plus content learning practical deeper code location interest multiple practical practical password simple operation italics method more friends Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Shulou Tech Info Redmi Huawei NVidia