Linux uses MySQL to forget root password and modify MySQL default encoding _linux

Source: Internet
Author: User
Tags mysql in mysql login mysql view

Overview:

This article no longer to the MySQL grammar explanation and explanation, want to understand or familiar with the friend please own Baidu or Google learning. This article is mainly aimed at MySQL in addition to the grammar of the summary, I hope to be able to also help you.

1.centos6.x under MySQL forget root password solution

Ⅰ. To modify MySQL login settings

# VIM/ETC/MY.CNF

In the [MYSQLD] paragraph, add a sentence: Skip-grant-tables

Ⅱ. Restart Service

# Service Mysqld Restart

Ⅲ. login MySQL, modify password information
# MySQL
mysql> use MySQL;
mysql> UPDATE user SET Password=password (' New-password ') WHERE user= ' root ';
mysql> flush Privileges;
Mysql> quit

Ⅳ. Restore MySQL Login settings

# VIM/ETC/MY.CNF

Add a skip-grant-tables annotation or delete in a section of [mysqld]

Ⅴ. Restart Service

# Service Mysqld Restart

2.centos6.x Modify MySQL default encoding

Ⅰ. login MySQL View encoding format

Show variables like ' character% ';

Ⅱ. copy my-large.cnf file to/etc/my.cnf

Cp/usr/share/doc/mysql-server-4.1.12/my-large.cnf/etc/my.cnf

Ⅲ. Edit my.cnf file modify default encoding format

Vim/etc/my.cnf

Add Default-character-set=utf8 in the [mysqld] section
Add Default-character-set=utf8 in the [client] segment

Ⅳ. # service mysqld Restart # Restart Services

Ⅴ. Verify if the modification succeeds: show variables like ' character% ';

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

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.