Official: http://dev.mysql.com/downloads/mysql/
1. Download the appropriate version and extract it to the /usr/local/mysql directory;
2. Proceed to the/usr/local/mysql directory, create the Data/mysql directory, then set the database to be saved in this directory;
3. Adding users and user groups
-G MySQL MySQL
3.1
Useradd-r-s/sbin/nologin-g mysql mysql-d/usr/local/mysql ---New MSYQL user Forbidden Login Shell
4. Changes to the directory belong to the person
chown -R mysql:mysql./
4.1
Chown –R MySQL. chgrp –R MySQL. chown -R mysql/usr/local/mysql/data/mysql
5. Install the database
./bin/mysqld--initialize--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data/mysql
Above is the latest installation method, before the old installation command is
./bin/mysql_install_db--user=mysql--datadir=/usr/local/mysql/data/mysql
6. Configure Mysql-server
CP support-files/mysql.server/etc/init.d/mysqldchmod755 /etc/init.d/ MysqldCP SUPPORT-FILES/MY-DEFAULT.CNF/ETC/MY.CNF
7. Modify the startup script/etc/init.d/mysqld, set basedir and DataDir to MySQL installation directory and database storage directory
basedir=/usr/local/mysql/datadir=/usr/local/mysql/data/mysql
Related commands
#测试连接. /mysql/bin/mysql-u root# start mysqlservice mysqld start# close Mysqlservice mysqld stop# view running status service mysqld status
8. After the database is installed, the password has not been set at this time, then the MySQL login password needs to be modified
' Your password # Set Password # Let the password take effect immediately
Reference from: http://bbs.51cto.com/thread-804870-1-1.html
8.1 In addition to the method above, there is another way to ()
1, add skip-grant-at the end of/ETC/MY.CNFtables, save, skip authentication. 2, restart MySQL to make the configuration you just modified take effect. 3, terminal input MySQL, and then enter use MySQL;4, terminal input Update mysql.user set Authentication_string=password ('123456') Where user='Root';5, remove skip-grant-at the end of/ETC/MY.CNFtables, save. 6, restart MySQL, terminal input mysql-u root-p, and then follow the prompts to enter the password you just set for normal use. Description: The reason to change the password is because Access denied forUser'Root'@'localhost'Error, change the password by password-free login, enter the update mysql.user set Password=password ('123456') Where user='Root'When prompted Unknown column'Password' inch 'Field List', the original is the MySQL database has no password This field, password field changed to Authentication_string.
9. Configure Auto-start
chmod 755 /etc/init.d/--345 MySQL on
10. Issues that may be encountered
Q:error while loading shared libraries:libaio.so.1
A: Refer to [Link], sudo apt-get install Libaio-devel
Q:Can t find Messagefile '/usr/share/mysql/english/errmsg.sys
A: Refer to [Link] and copy the Mysq-x.x.x/sql/share/english/errmsg.sys to the/usr/share/mysql/english/of the system.
Q:couldn ' t find MySQL server (/usr/bin/mysqld_safe)
A: Reference [Link], RM/ETC/MYSQL/MY.CNF
Q:table ' mysql.plugin ' doesn ' t exist
A: Refer to [Link1, Link2] because the MySQL database is not installed correctly
Execute in MySQL directory:./scripts/mysql_install_db--user=mysql--datadir=/data/mysql
Reference from:
Link1,link2
Password issues when Useradd
Linux MySQL Installation configuration