MySQL init command and other commands

Source: Internet
Author: User

This question has been bothering me for two years:

In order to configure the parameters for undo in my.cnf to take effect, and to generate an undo file, use the command

/usr/bin/mysql_install_db--defaults-file=/etc/my.cnf--datadir=/dbfiles/data--basedir=/dbfiles/

Time-consuming reason is, do not look help, only know Baidu

After MySQL is initialized, change the root password:

ALTER USER ' root ' @ ' localhost ' identified by ' 11111 ';

After forgetting the password, change the root password: (MySQL with a high version, requires a minimum of 8 digits, and requires a combination of numbers, lowercase letters, uppercase letters, special characters)

Update user set Authentication_string=password (' 123a*fdf ') where user= ' root ' and host= ' localhost ';

Excerpt from: http://www.cnblogs.com/xxoome/p/6170579.html

To create a user:

#foo表示你要建立的用户名, the following 123 represents the password, #localhost限制在固定地址localhost登陆CREATE USER [email protected] identified by ' 123 ';

2. Authorization

GRANT privileges on Databasename.tablename to ' username ' @ ' host '

Description: Privileges-user's operation permissions, such as SELECT, INSERT, UPDATE, etc. Use all if you want to grant the permission;
DatabaseName-database name, tablename-table name, if you want to grant the user permission to operate on all databases and tables, the * representation is available *, such as *. *

For example:

GRANT insert,delete,update,select on Test.user to ' foo ' @ ' localhost ';
Flush privileges;

3. Setting and changing user passwords

Set PASSWORD for ' username ' @ ' host ' = PASSWORD (' newpassword ') #如果是当前登陆用户SET PASSWORD = PASSWORD ("NewPassword"); #例如: SET PASSWORD for ' foo ' @ '% ' = PASSWORD ("123456"); update Mysql.user set Password=password (' New password ') where user= "Phplamp" and host= "LocalHost";

MySQL init command and other commands

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.