MySql与数据库设计规范

2019-08-01  本文已影响0人  Roct

1. 用Homebrew进行安装

brew install mysql

一直等到出现

We've installed your MySQL database without a root password. To secure it run:
    mysql_secure_installation

MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -uroot

To have launchd start mysql now and restart at login:
  brew services start mysql
Or, if you don't want/need a background service you can just run:
  mysql.server start

安装成功.

2. 对数据库进行初始化配置

mysql.server start
mysql_secure_installation

根据提示进行数据库的配置
是否需要配置密码

Press y|Y for Yes, any other key for No: // 选择Y则需要配置8位数的密码

输入Y以后, 可以看到提示

LOW    Length >= 8  // 长度大于等于8就可以
MEDIUM Length >= 8, numeric, mixed case, and special characters // 长度大于8数字、混合大小写和特殊字符
STRONG Length >= 8, numeric, mixed case, special characters and dictionary  //  长度>= 8,数字,混合大小写,特殊字符和字典
file 
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG:

这里根据你的要求输入0 , 1 , 2就可以
然后会提示你输入密码

Please set the password for root here.

New password:

然后确认密码:

Re-enter new password:

如果密码输入的不符合要求, 会这样提示

Estimated strength of the password: 25
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y
 ... Failed! Error: Your password does not satisfy the current policy requirements

当密码设置成功以后

是否移除不用密码的那个账户

Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL 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.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : //  是否移除不用密码的那个账户

输入

Y

是否禁止远程登录

Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : // 是否禁止远程登录

输入

N

是否删除test库

By default, MySQL 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.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : // 是否删除test库

输入

Y

是否重新加载

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : // 是否重新加载

输入

Y

回车以后就可以看到

All done!

登录数据库

mysql -uroot -p

输入刚刚的密码, 就能够登录上现在的数据库了.

数据库服务

启动:brew services start mysql

停止:brew services stop mysql

数据库设计规范

数据库命名规范

数据库基本设计类型

索引设计规范

数据库字段设计规范

数据库SQL开发规范

上一篇 下一篇

猜你喜欢

热点阅读