mysql mac如何设置密码

发布时间:2024-02-19
mysql mac设置密码的方法:首先打开终端安装mysql;然后设置mysql为开机启动项目;接着启动mysql;最后通过命令“mysql_secure_installation”设置密码即可。
推荐:《mysql视频教程》
打开终端:
安装mysql:
brew install mysql
设置mysql为开机启动项目:
ln -sfv /usr/local/opt/mysql/*.plist ~/library/launchagents
启动mysql
mysql.server start
设置密码:
mysql_secure_installation
运行mysql_secure_installation会执行几个设置:
a)为root用户设置密码
b)删除匿名账号
c)取消root用户远程登录
d)删除test库和对test库的访问权限
e)刷新授权表使修改生效
代码如下:
[root@server1 ~]# mysql_secure_installation
note: running all parts of this script is recommended for all mysql
servers in production use! please read each step carefully!
in order to log into mysql to secure it, we'll need the current
password for the root user. if you've just installed mysql, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
enter current password for root (enter for none):<–初次运行直接回车
ok, successfully used password, moving on…
setting the root password ensures that nobody can log into the mysql
root user without the proper authorisation.
set root password? [y/n]<– 是否设置root用户密码,输入y并回车或直接回车
new <– 设置root用户的密码
re-enter new <– 再输入一次你设置的密码
password updated successfully!
reloading privilege tables..
… success!
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? [y/n]<– 是否删除匿名用户,生产环境建议删除,所以直接回车
… success!
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? [y/n]<–是否禁止root远程登录,根据自己的需求选择y/n并回车,建议禁止
… success!
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? [y/n]<– 是否删除test数据库,直接回车
– dropping test database…
… success!
– removing privileges on test database…
… success!
reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
reload privilege tables now? [y/n]<– 是否重新加载权限表,直接回车
… success!
cleaning up…
all done! if you've completed all of the above steps, your mysql
installation should now be secure.
thanks for using mysql!
[root@server1 ~]#
设置完,可以安装一个 mysqlworkbench 就可以可视化操作数据库了。
上一个:漫步苏州水月禅寺 品宋人茶诗净心
下一个:在线式木材干燥控制仪

win10自动关机重启怎么办(win10 1909关闭自动更新方法)
w11如何激活(wondows11激活)
云南省景谷县茶业概况简述(一)
笔记本电脑滋滋响怎么办(笔记本电脑有滋滋滋杂音)
固态硬盘的线插在主板哪里,硬盘线插在主板的哪个接口上
真空油在电机马达中的作用及使用方法
norgren电磁阀选购指南(型号价格一网打尽)
RTA03-4D47R0DTP排阻,旺诠RD4D03-47R
紫枝玫瑰育苗技术要点
如何控制伺服位置环计数器溢出的问题