Install MySQL5.6 & amp; modify the root password & amp; create a user with certain Permissions

Source: Internet
Author: User

Install MySQL5.6 and modify the root password.
1. After MySQL5.6 is installed, MySQL cannot be enabled properly. 1. After decompression, go to my computer> Properties> advanced> environment variables.
Select PATH and add the PATH of the mysql bin folder (for example, C: \ Program Files \ MySQL Server 5.6 \ bin)
2. modify or add configuration in the my-default.ini:
[Mysqld]
Basedir = C: \ Program Files \ MySQL Server 5.6 (mysql directory)
Datadir = C: \ Program Files \ MySQL Server 5.6 \ data (mysql directory \ data)
Port = 3306
3. Run cmd as an administrator and enter mysqld-install
4. After the installation is successful, start the service. In cmd, enter net start mysql (). The service starts successfully!
5. After the service is successfully started, you can log on. Enter mysql-u root-p (no password for the first login, press Enter!
Ii. MySQL5.6 forget the root password 1. First, net stop mysql service and switch to the task manager. It is recommended that you close the process if it is related to mysql.
2. Run the CMD command to switch to the MySql installation bin directory and execute mysqld -- skip-grant-tables (note that there is no semicolon next)
3. Do not close the command line window and open a new command line window again. Note: At this time, a warning may appear, so ignore it.
4. Open a new cmd window again. Run the following command in the bin directory: mysql-u root-p. Enter the password and press Enter.
5. Execute the command: update mysql. user set password = PASSWORD ('root') where User = 'root ';
6. Refresh and execute: mysql> flush privileges;
7. Close the window and log on
3. create a user and grant certain permissions (with the select, delete, update, create, and drop permissions). 1. log on to the user with all permissions.
2. Create a user: mysql> insert into mysql. User (Host, user, Password) values ("localhost", "test", password ("1234 "));
3. Authorize the user: grant permission on database. * to username @ login host identified by "password ";
4. Refresh the system permission table: mysql> flush privileges;
Example 1:

mysql>grant select,update on testDB.* to test@localhost identified by '1234';mysql>flush privileges;
Example 2:
mysql>grant all privileges on *.* to test@localhost indentified by '1234';

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.