Tips, troubleshooting, and Utility commands for installing MySQL database (continuous update)

Source: Internet
Author: User

For unzipped version 5.7.16 (this version used by bloggers, some commands fail in some low versions)

First, initialize the data directory (uncompressed version of the data directory after decompression)

Before this MySQL decompression, and configure the PATH environment variable, then administrator cmd input mysqld-install install MySQL.

Initialize command: mysqld--initialize-insecure--user=mysql

Second, modify the root password, connect to the database after use MySQL


1. Update Mysql.user set Authentication_string=password (' 123qwe ') where user= ' root ' and Host = ' localhost ';
The new version of MySQL has no password field, but the encrypted user password is stored in the Authentication_string field, so many methods on the Web is not available, after the execution of the service will be effective after the restart
You will need to restart the service to take effect whenever you change your password.
2, mysqladmin–u user name –p old password Password new password

3, not yet try mysql> set password for [email protected] = password (' 123 '); Note: It is best to knock the hand to avoid the wrong sign

Third, if you forget the root password (not connected to the database to modify the root password)

1. The administrator runs the first cmd, enter net stop MySQL to close the MySQL service, and then enter Mysqld--skip-grant-tables to skip the password
2, keep the cmd of the previous step does not close, the administrator runs another cmd, directly enter Mysql-u root-p Enter, display the input password, the direct return can be password-free login
3, you can change the root password in the second cmd (see two).
Note: The process MySQL does not have a net start MySQL operation.

Four, net start MySQL when there is no start

Check to see if it is started, or if there is a mysqld.exe process running in the process.

MyEclipse Database Explorer to establish MySQL connection error

Testdriver error while performing database login with the testmysql driver check your URL. Check for URL connection no problem. The problem is with the driver classname, which is automatically populated with this name after the add MySQL jar package is called Com.mysql.fabric.jdbc.FabricMySQLDriver. This is wrong and should
Com.mysql.jdbc.Driver. You can resolve the problem that indicates that the error is not connected.

When connecting to a database in Java, we often use such statements in order to prevent the stored data from being garbled:

Jdbc:mysql://localhost:3306/weibo?useunicode=true&characterencoding=utf8

The last characterencoding is the encoding of the specified database.

Vi. MySQL Utility commands

1. Enquiry

(1), starting from the No. 0 row, take 3 lines
SELECT * FROM student limit 0,3

(2), view current database encoding

Show variables like ' character_set_database ';

(3), modify the database code (XXX is the database name)

ALTER DATABASE XXX CHARACTER SET gb2312;

Tips, troubleshooting, and Utility commands for installing MySQL database (continuous update)

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.