Description:My ECS is just rented pure, all the environment need their own settings, this article is my entire process to share, the online read a lot of information, inspired very big, but failed many times, there are installed through the rpm file, no success, there is Yum installed, I did not succeed, Finally decisively through the compression package of the way to install, and finally everything is smooth! Now let's share this! Instruction for use: (1). The path in this installation is for reference only (2). Xshell for connection tools, xftp for file transfer tools
1. Installing CMakecommand: Yum install-y cmakedetailed command:CMake is the Makefile tool that is designed to produce portable makefile and simplify the enormous amount of work you do when you write makefile.
2. Install makeCommand: Yum install-y makedetailed command:The most important and basic function of the Make tool is to use the makefile file to describe the interrelationship between the source programs and to automatically maintain the compilation work. While the makefile file needs to be written in a certain syntax, the file needs to explain how to compile the individual source files and connect to build the executable file, and ask to define the dependencies between the source files.
3. Enter the/usr/local/directory (please ignore directory MySQL, mysql-5.5.27, and zip file mysql-5.5.27.tar.gz, so it is not installed)Command: cd/usr/local/
4. Create directory MySQL and mysql/data two directories, MySQL is used to install Mysql-5.5.27,data for storing databaseCommand: mkdir-p/usr/local/mysql mkdir-p/usr/local/mysql/data
5. Download MySQL compression pack mysql-5.5.27.tar.gzMode one: Download directly to the local directory using the wget command via the network connection; resources: http://download.csdn.net/detail/musuny/8564645
Mode two: Download the compressed package in advance and transfer it to the local directory via XFTP. Compressed packet network: After the download is complete, a mysql-5.5.27.tar.gz file is added to the local directory
6. Unzip the packageCommand: TAR-ZXVF mysql-5.5.27.tar.gz command in detail:-Z: Decompression with gzip-x: read from the specified file list of files that you do not want to include-V: Display a list of processing files -F: Use script f at end of each disk to extract the local directory after the completion of the mysql-5.5.27 directory
7. Enter the catalogue mysql-5.5.27Command: CD mysql-5.5.27
8. Using the CMake command, the command content can be copied directly without modification (premise: the MySQL and data paths mentioned earlier are consistent with mine)Command content: CMake \
-dcmake_install_prefix=/usr/local/mysql \
-dmysql_unix_addr=/usr/local/mysql/data/mysql.sock \
-DDEFAULT_CHARSET=UTF8-DDEFAULT_COLLATION=UTF8_GENERAL_CI \
-DWITH_EXTRA_CHARSETS:STRING=UTF8,GBK \
-dwith_myisam_storage_engine=1 \
-dwith_innobase_storage_engine=1 \
-dwith_memory_storage_engine=1 \
-dwith_readline=1 \
-denabled_local_infile=1 \
-dmysql_datadir=/usr/local/mysql/data/\
-dmysql_user=mysql-dmysql_tcp_port=3306 NOTE: \ must not be omitted
9. Use makeCommand: Make
10. Use make installCommand: Make install
11. Copy and rename my.cnf to/usr/local/mysql/support-files/my-dedium.cnfCommand: CP/USR/LOCAL/MYSQL/SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF
12.chmod 755 scripts/mysql_install_db Change file directory permissionsPermission Description: chmod ABC fileEach of the a,b,c is a number that represents the permissions of the user, Group, and other respectively. r=4,w=2,x=1to rwx the attribute then 4+2+1=7;to rw-the attribute then 4+2=6;to r-x the property, 4+1=7. Example:chmod a=rwx file and chmod 777 file effect are the samechmod ug=rwx,o=x file and chmod 771 file effect are the sameuse chmod 4755 filename to give the program root privileges755 Permissions: The owner has read, write, execute permissions, but the group of users and other users only read, execute permissions.
13. Initialize the database (similarly, if the directory is consistent with mine, the command can be modified without modification)Command content: scripts/mysql_install_db \
--user=mysql \
--basedir=/usr/local/mysql \
--datadir=/usr/local/mysql/data/
At this point, MySQL has been installed successfully, you can use the MySQL command test, followed by some settings
14. Copy the boot file to bootCommand: Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysql
15. Change the/etc/init.d/mysql permissionsCommand: chmod 755/etc/init.d/mysql
16. Set boot upCommand: Chkconfig MySQL on
17. Add the MySQL bin directory to the environment variableCommand: Echo ' export path=/usr/local/mysql/bin: $PATH ' >>/etc/profile
18. Make Environment variables effectiveCommand: Source/etc/profile
19. Start MySQL, reboot restart the server if it cannot be started
20. View 3306 Port StatusCommand: Netstat-nat|grep 3306
21. Firewall Open 3306 port, edit edit iptables, if there is no this file, the newCommand: Vi/etc/sysconfig/iptables (Vim is OK)
22. Add-A input-m State--state new-m tcp-p TCP--dport 3306-j Accept to file: Wq Save Modify
23. Restart the firewall
24. Log in to MySQL and set a new password(1) Initial login command: MySQL then need to set the password (2) non-initial login command: Mysql-u root-p then enter the password, you can login
If prompted: ERROR 1044 (42000): Access denied for user "@ ' localhost ' to database ' MySQL '. is because the user table of the MySQL database, the existence of the username is empty account is anonymous account, resulting in the log in when the use of root, but the actual anonymous login, through the error message "@" localhost can be seen
25. Set a new passwordmysql> use MySQL;mysql> Update user set password= password ("123456");
26. Now using Navicat cannot connect to the database remotely, so you need to turn on Allow remote connection databasemysql> Select ' Host ', ' user ' from user;
Set host to% to allow remote connections
Finally, restart the MySQL service, command:/etc/init.d/mysql restartTest Connection: Enter the IP address, account number, password to log in
27. Finally, this database only supports administrator login, that is, root user, first create other user
Test Connection
At this point, the MySQL installation of Linux under the complete process to this end, share to everyone! I am also a novice, inevitably have flaws, please forgive me, what good advice can reply Oh!
MySQL User management share blog: http://blog.aizhet.com/SQL/9302.html
Alibaba ECS Server CentOS Linux system installation MySQL-5.5.27