MariaDB创建用户、数据库

目标:

用户名:sampleuser
数据库名:sampledb
密码:samplepass

命令:

# Step1: Install MariaDB

yum install mariadb
systemctl start mariadb
systemctl enable mariadb


# Step2: Initialize MariaDB

mysql_secure_installation
Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y


# Step3: Create user and database

mysql -u root -p
MariaDB [(none)]>CREATE DATABASE sampledb;
MariaDB [(none)]>CREATE USER 'sampleuser'@'%' IDENTIFIED BY 'samplepass';
MariaDB [(none)]>GRANT ALL on sampledb.* to 'sampleuser'@'%';
MariaDB [(none)]>FLUSH PRIVILEGES;
MariaDB [(none)]>exit

 

暂无评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注