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

设置修改mysql密码_更改或设置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密码