设置修改mysql密码_更改或设置MySQL根密码

博客介绍了设置修改 MySQL 密码的方法。指出为避免被黑客入侵,应将 root 密码设为非默认值。可从命令行使用 mysqladmin 实用程序设置新密码,并给出了具体命令语法和示例,还提到运行命令后需重启数据库服务器。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

设置修改mysql密码

设置修改mysql密码

For every database, you should set the root or sa passwords to something other than the default, unless you want to get hacked. For mysql, the system administrator user is called root. You will use the mysqladmin utility from a command line to set the new password. Notice that there are two commands to be run.

对于每个数据库,除非您希望被黑客入侵,否则应将root或sa密码设置为默认密码以外的其他密码。 对于mysql,系统管理员用户称为root。 您将从命令行使用mysqladmin实用程序来设置新密码。 请注意,有两个命令要运行。

Syntax:

句法:

mysqladmin -u root password “newpassword”

mysqladmin -u root密码“ newpassword”

mysqladmin -u root -h host_name password “newpassword”

mysqladmin -u root -h host_name密码“ newpassword”

Example:

例:

mysqladmin -u root password ws8dr8as3

mysqladmin -u root密码ws8dr8as3

mysqladmin -u root -h localhost password ws8dr8as3

mysqladmin -u root -h localhost密码ws8dr8as3

You will also want to restart the database server after running this command

您还将希望在运行此命令后重新启动数据库服务器

sudo /etc/init.d/mysql restart

sudo /etc/init.d/mysql重新启动

翻译自: https://www.howtogeek.com/howto/mysql/set-the-mysql-root-password/

设置修改mysql密码

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值