Recently someone asked me about MySQL password settings, just recently there is a MySQL server in need of general optimization configuration, then here is a simple:
First, the MySQL password settings
You know, in the actual production environment, MySQL root user without password is very insecure, and in the new installation of MySQL generally no password, then we after the deployment of MySQL in addition to the necessary security measures (see:/http jim123.blog.51cto.com/4763600/1864671) and add a password to the root user of MySQL, and to the user to add or change the password is to modify the Mysql.user this table, then the MySQL set or change the password method there are 3 kinds.
1, using the Mysqladmin client tool, this is a very powerful MySQL management tool, it is located in the MySQL installation directory under the Bin directory, it is easy to use it to add, modify the user's password:
[[email protected] ~]# mysqladmin-u Username-p password password New password # to note that the newly installed MySQL root does not have a password, so here the-p parameter option can be omitted
2, in the MySQL interactive interface set password sets the password, this is more commonly used, it is implicitly using the Mysql.user table so it can be used directly under the interactive interface of MySQL, the method is as follows:
mysql> set password for ' root ' @ ' localhost ' = password (' newpassword '); #这里执行完后会隐式执行flush privileges; So the settings will take effect immediately.
3. Update the Mysql.user table in the MySQL interactive interface:
mysql> Update mysql.user Set password = password (' newpassword ') #在update后需要flush privileges; second, If you need to give the same user different authorized host bulk encryption can mysql> update mysql.user set password = password (' newpassword ') where user = ' root '
In general, MySQL user password settings are simple, now say again MySQL or other installed services for general optimization
Second, mysqld Configuration general optimization
1, first of all, we have the default mysqld in the system, then we use after installation of the man help is not the latest, it is necessary to modify the man class to help the configuration file, add the latest mysqld man help environment path
[Email protected] bin]# vim/etc/man.config Slightly ... # manbin/usr/local/bin/man## every automatically generated MANPATH includes these FIELDS#MANPATH/USR/MANM anpath/usr/share/manmanpath/usr/local/manmanpath/usr/local/share/manmanpath/usr/x11r6/manmanpath/usr/local/ mysql/man# Add the path to the man help in mysqld so that man is up to date
2, modify the system of the default MySQL dynamic link library, this if not changed when MySQL will not start, and the System Management dynamic link library can be managed by ldconfig
[Email protected] ~]# cd/etc/ld.so.conf.d[[email protected] ld.so.conf.d]# vim mysql.conf/usr/local/mysql/lib# This is the path of the latest mysqld dynamic library [[email protected] ld.so.conf.d]# ldconfig# execution under load, be aware of how to create links to/lib or lib64/as well as/usr/lib or/usr/ Lib64, also to #ldconfig execution under
3, in order to use the usual convenient to the MySQL bin directory added to the environment variable
[Email protected] ld.so.conf.d]# cd/etc/profile.d/[[email protected] profile.d]# vim mysql.shexport path= $PATH:/usr/ Local/mysql/bin[[email protected] profile.d]# source mysql.sh# can also be modified in the/etc/profile file, after the change to the source for the environment variable to take effect
So the basic configuration of MySQL optimization is good, of course, like Apache and other services can be so modified
This article from the "Technical essay" blog, reproduced please contact the author!
MySQL password settings and general optimization configuration