How to configure the MySQL database in Debian

Source: Internet
Author: User
Generally, you will be asked to enter the root password in the previous step. if you do not have the root password, you must change it for security reasons! First, let's see if your mysql has no password: If you can see the mysql version information, it proves that there is no password for MySQL at present. Run mysqladminpasswordxxxxxx to change the password: # mysqladminpasswordxxxxx you will be asked to enter the root password in the previous step. if not, you must change your password to ensure security!
Let's take a look at your MysqlIs there really no password:


If you can see the mysql version information, it proves that MySQL currently has no password.
Run mysqladmin password xxxxxx to change the password:

# Mysqladmin password xxxxxx

Here, xxxxxx is your new password.
Now you need to run mysqladmin version -- user = root -- pass, and then enter the password to view the version number and other information.
Note: The -- user = root -- pass part in the preceding command can be abbreviated as-u root-p. Let's test whether the password has taken effect:

# Mysqladmin version-u root-p
Enter password:

3. enable Port 3306 listening

This work should be careful. In security considerations, by default, Debian closes port 3306. Because many hackers use it to attack your system. If you do not use other machines to access the database, do not open this port.
Modify/etc/mysql/my. cnf and find:

Comment it out:

You can also modify some attributes in/etc/mysql/my. conf.
This line originally exists: bind-address = 127.0.0.1, which means only the local machine can access the service and is willing to ensure data security. To allow remote machines to access the MySQL database service, you can change bind-address:

1. bind-address = 0.0.0.0

2. comment out the bind-address line directly.

4. modify the default character set
  
Let MySQL use simplified Chinese as the default character set. Edit/etc/init. d/mysql and find this line:

/Usr/bin/safe_mysqld>/dev/null 2> & 1 &

Changed:

/Usr/bin/safe_mysqld> -- default-character-set = gb2312>/dev/null 2> & 1 &

OK. restart MySQL:

#/Etc/init. d/mysql restart

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.