MySQL configuration in Debian
1. Modify the MySQL password
Because MySQL does not have a password by default, you must modify your password for security reasons!
Let's see if your MySQL has 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: |
2 open port 3306 listener
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:
3. 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 |