Home > Database > Mysql Tutorial > Share 3 ways to set passwords for Mysql installation-free version

Share 3 ways to set passwords for Mysql installation-free version

零下一度
Release: 2017-05-04 13:29:30
Original
1632 people have browsed it

This article mainly introduces Mysqldetailed tutorial on setting the password for the installation-free version. Friends who need it can refer to

Method 1: Use the SET PASSWORD command

 MySQL -u root
  mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
Copy after login

Method 2: Use mysqladmin

mysqladmin -u root password "newpass"
Copy after login

If root has already set a password, use the following method

mysqladmin -u root password oldpass "newpass"
Copy after login

Method 3: Use UPDATE directly Edit the user table

mysql -u root
  mysql> use mysql;
  mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root';
  mysql> FLUSH PRIVILEGES;
Copy after login

When you lose the root password, you can do this

mysqld_safe --skip-grant-tables&
  mysql -u root mysql
  mysql> UPDATE user SET password=PASSWORD("new password") WHERE user='root';
  mysql> FLUSH PRIVILEGES;
Copy after login

The above is the detailed explanation of the password setting tutorial for the Mysql installation-free version introduced by the editor. I hope it will be helpful to you. This is helpful to everyone. If you have any questions, please leave me a message and I will reply to you in time!

【Related recommendations】

1. Free mysql online video tutorial

2. MySQL latest manual tutorial

3. Six days to take you through MySQL video tutorial

The above is the detailed content of Share 3 ways to set passwords for Mysql installation-free version. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template