#这里是问你是否重置或创建新密码 Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation.
#这里直接选择是y Set root password? [Y/n] y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. #创建成功提示 ... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. #默认情况下,MariaDB 安装会有一个匿名用户,这使得任何人无需创建用户账户即可登录 MariaDB。这仅用于测试目的,以使安装过程更顺畅一些。在进入生产环境之前,你应该删除这些匿名用户。
Remove anonymous users? [Y/n] n ... skipping.
Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. #通常情况下,应该只允许 root 从 “localhost” 进行连接。这能确保没有人能从网络上猜出 root 密码。
Disallow root login remotely? [Y/n] n ... skipping.
By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. #默认情况下,MariaDB 带有一个名为 “test” 的数据库,任何人都可以访问。此数据库仅用于测试目的,在进入生产环境之前应将其删除。
Remove test database and access to it? [Y/n] n ... skipping.
Reloading the privilege tables will ensure that all changes made so far will take effect immediately. #重新加载权限表将确保到目前为止所做的所有更改立即生效。
Reload privilege tables now? [Y/n] n ... skipping.
Cleaning up...
#全部准备好后出现这个提示则表示成功 All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!
# 创建WordPress数据库和用户(wordpress为数据库名) CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER '用户名'@'localhost' IDENTIFIED BY '数据库密码'; GRANT ALL PRIVILEGES ON wordpress.* TO '用户名'@'localhost'; FLUSH PRIVILEGES; EXIT;
mysql -u root -p CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER '用户名'@'localhost' IDENTIFIED BY '密码'; GRANT ALL PRIVILEGES ON wordpress.* TO '用户名'@'localhost'; FLUSH PRIVILEGES; EXIT;