- Download cmake-2.8.12.2.tar.gz,: https://pan.baidu.com/s/1qYtpX7m
- Download mysql-5.5.37.tar.gz,: http://pan.baidu.com/s/1miFcNP2
- Download ncurses-5.9.tar.gz,: http://pan.baidu.com/s/1kVDIXW7
(Baidu Network disk connection address use wget download not)
4. Upload the above three packets to the server and unzip the
[Email protected] mysql-5.5.37]# tar xvf mysql-5.5.37.tar.gz
5. Enter the cmake-2.8.12.2 directory (if there is an error please see the end of the article)
[Email protected] cmake-2.8.12.2]#./configure
[[email protected] cmake-2.8.12.2]# make && make install
6. Enter the mysql-5.5.37 directory
[Email protected] ~]# CD mysql-5.5.37
[[email protected] mysql-5.5.37]# cmake./(See the end of the article if you have an error)
7. After resolving the above error, continue to execute (if there is no error, this step can skip directly)
[Email protected] ncurses-5.9]# CD.
[Email protected] ~]# CD mysql-5.5.37
[Email protected] mysql-5.5.37]#
[Email protected] mysql-5.5.37]# rm-f CMakeCache.txt
Because just did not compile successfully, so need to delete just compile generated CmakeCache.txt file, otherwise pass, then re-cmake.
[Email protected] mysql-5.5.37]# CMake.
8. Start the installation, MySQL default will be installed successfully to/usr/local/mysql
[[email protected] mysql-5.5.37]# make && make install
9. Create a MySQL user and MySQL group in the process of installing it
[[email protected] ~]# Groupadd MySQL
[[email protected] ~]# useradd-r-g MySQL MySQL
[Email protected] ~]# chown-r mysql.mysql/usr/local/mysql
This directory, if not installed successfully, is not able to operate the/usr/local/mysql directory
10. Start MySQL
[Email protected] ~]#/usr/local/mysql/bin/mysqld_safe--user=mysql
11. Register MySQL service, set boot automatically
Copy the configuration file to etc under:
[Email protected] ~]# CP/USR/LOCAL/MYSQL/SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF
Copy the MySQL boot file to the INIT.D directory and name it MySQL
[Email protected]iz25bdzgev8z ~]# Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysql
[Email protected] ~]# chmod +x/etc/init.d/mysql
[[email protected] ~]#/sbin/chkconfig--add MySQL
To add a system variable:
[[email protected] ~]# Vi/etc/profile #修改profile文件, the next reboot will also take effect
Export path= $PATH:/usr/local/mysql/bin # Add this line configuration in the configuration file
[Email protected] ~]# Source/etc/profile
Modify the. bashrc file to take effect under the current user shell
# VI/ROOT/.BASHRC
Add in:
Exportpath= $PATH:/usr/local/mysql/bin
After modifying this file, you also need to use source to make the configuration file effective.
To start the MySQL service:
[[Email protected]~]# service MySQL start (may be error)
Startingmysql ... The server quit without updating PID file [Failed]cal/mysql/data/iz25bdzgev8z.pid].
Restart Service
[Email protected]~]#/usr/local/mysql/scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/ Usr/local/mysql/data
Installing MySQL system tables ...
Try to connect:
[Email protected] ~]#/usr/local/mysql/bin/mysql-u root-p
12. Log in to MySQL
[Email protected]~]#/usr/local/mysql/bin/mysql-u root-p
Enterpassword:
ERROR2002 (HY000): Can ' t connect to local MySQL server through socket '/tmp/mysql.sock ' (2) #没有mysql. sock file
[Email protected]/]# killall mysqld
[Email protected]/]# killall MySQL #杀死所有和mysql相关的进程
[[Email protected]~]# ls/tmp/mysql
Ls:cannotaccess/tmp/mysql:no such file or directory
[Email protected]~]# Find/-name mysql.sock #找一找
/var/lib/mysql/mysql.sock
Modify the MY.CNF configuration file, restart MySQL, and then log in again
[Email protected] ~]# VI/ETC/MY.CNF
[Client]
#password =your_password
Port = 3306
#socket =/tmp/mysql.sock
Socket =/var/lib/mysql/mysql.sock #如果这个不行, also need to be the above line to untie the comments ...
[[Email protected]/]# Netstat-tnulp | grep 3306 #过滤下3306, there should be no information at this time
[[Email protected]/]#/etc/rc.d/init.d/mysql Start
Starting MySQL. [OK]
#此时再过滤3306应该有数据了
13. Log in with MySQL
[[email protected]/]# MySQL
Welcome to the Mariadbmonitor. Commands End With; or \g.
Your MySQL Connection Idis 1
Server Version:5.5.37-logsource Distribution
Copyright (c), 2016,oracle, MariaDB Corporation Ab and others.
Type ' help; ' or ' \h ' forhelp. Type ' \c ' to clear the current input statement.
MySQL [(None)]> exit
Bye
Errors and their solutions:
1. When the installation cmake is executed, make will report the following error:
E: * * * No targets specified and no makefilefound. Stop.
Solution:
This is caused by no installation of the build environment, the networked installation of GCC
Yum install gcc gcc-c++ autoconf automake
2. Error message when installing MySQL 5.5.37:
Curses Library NotFound. Installappropriate Package,
Remove CMakeCache.txt and rerun CMake. On Debian/ubuntu, package name Islibncurses5-dev, on Redhat and derivates it is ncurses-devel.
Call Stack (most recent call first):
cmake/readline.cmake:127 (find_curses)
cmake/readline.cmake:217 (Mysql_use_bundled_libedit)
cmakelists.txt:355 (Mysql_check_readline)
Ncurses is a basic library of screen control under the character terminal, many newly developed programs are no longer used, but to compile some old programs, or will often encounter, to solve this problem is to install curses can
[Email protected] ~]# tar xvfncurses-5.9.tar.gz
[Email protected] ~]# CD ncurses-5.9
[[email protected] ncurses-5.9]#./configure && make && make install
002. CENTOS7 Installation mysql5.5.37