MySQL use notes (i)

Source: Internet
Author: User

First, installation

To install with a version that is free of installation:
1. Unzip to the installation directory
2. The My-default.ini file under the Copy directory is the My.ini file
3. Modify the contents of the My.ini file as

    [Client]    port=3306    Default-character-set=utf8    #客户端字符类型, consistent with the server, recommended UTF8    [mysqld]    port=3306    Character_set_server=utf8    #服务端字符类型, recommended UTF8    basedir=c:\program files\mysql    #解压根目录    datadir=c:\ Program Files\mysql\data    #解压根目录 \data    sql_mode=no_engine_substitution,strict_trans_tables    [ Winmysqladmin]    C:\Program files\mysql\bin\mysqld.exe

4. Modifying environment Variables
Add Mysql_home to C:\Program files\mysql
and add it after path;%mysql_home%\bin

5. Run cmd as administrator, to C:\Program Files\mysql\bin directory, execute

Mysqld-install

If this occurs, the Service successfully installed installation is successful.

6. Starting, stopping, and removing MySQL services
Start MySQL service: net start MySQL
Stop MySQL service: net stop MySQL
Remove MySQL service: mysqld-remove

7. Login
mysql -u 用户名(user does not have password) or mysql -u 用户名 -p (user contains password)
Initially, the root user does not have a password and can use mysql -u root Direct login.

Second, change the root password

(1) Log in as root and executeSET PASSWORD FOR ‘root‘@‘localhost‘=‘新密码‘
(2) Mysqladmin
If Root has no password, use themysqladmin -u root password 新密码, note the password without quotation marks;
If Root has already set a password, use the mysqladmin -u root -p password 新密码, note that the password is without quotation marks.
(3) Edit user table directly using update 
mysql-u root 
Mysql>use MySQL;  
mysql>update user SET password= ' newpass ' WHERE user= ' root ';  
Mysql>flush privileges;
 
     (4) If you lose the root password  
mysqld_safe--skip-grant-table& 
mysql-u root Mysql 
mysql> UPDATE User SET password= ' newpass ' WHERE user= ' root ';  
mysql> FLUSH privileges; &NBSP

about   FLUSH Privileges

The flush Privileges command essentially works by extracting the user information/permission settings from the current users and Privilige tables from the MySQL library (the built-in library of the MySQL database) into memory. MySQL user data and permissions have been modified, you want to "do not restart the MySQL service" in the case of direct effect, then you need to execute this command. Usually after you modify the root account settings, afraid to restart after the login can no longer, then directly after the flush to see whether the permissions are set to take effect. Without risking too much.

MySQL use notes (i)

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.