Share the whole process of installing MySQL 5.5 under CentOS 5.5
- 2020-05-14 05:04:11
- OfStack
Open a terminal
Switch to the root directory
Uninstall CentOS's own Mysql5.0 before installing Mysql5.5.
[root@localhost ~]# yum remove mysql
Install cmake
Download the cmake source package cmake-2.8.5.tar.gz
[root @ localhost ~] # wget http: / / www cmake. org files/v2. 8 / cmake - 2.8.5. tar. gz compiler installed [root @ localhost] # tar xzvf cmake - 2.8.5. tar. gz [root @ localhost] # cd cmake - 2.8.5 [root @localhost cmake-2.8.5]#./bootstrap Error when bootstrapping CMake: Cannot find appropriate C compiler on this one using environment using CC. See cmake_bootstrap. log compilers attempted. error: C compiler is missing.
Solution: install the gcc compiler
It can be installed from the installation disk of the Linux system or simply with yum
[root@localhost ~]# yum install gcc
Continue the installation of cmake
[root @localhost cmake-2.8.5]#./bootstrap Error when bootstrapping CMake: Cannot find C++ compiler on this system. Please specify one using environment
See cmake_bootstrap. See for compilers attempted again: Missing C++ compiler.
Install the gcc-c ++ compiler
It can also be installed from the installation disk of the Linux system, or simply with yum
[root@localhost ~]# yum install gcc-c++
Repeat the above
[root@localhost cmake-2.8.5]# ./bootstrap
After no error is reported, compile the installation
[root@localhost cmake-2.8.5]# make [root@localhost cmake-2.8.5]# make install[root@localhost cmake-2.8.5]# cmake -version
Start the formal installation of Mysql
Add mysql users and user groups
[root@localhost ~]# groupadd mysql [root@localhost ~]# useradd -g mysql mysql
Download the source package mysql-5.5.27.tar.gz for mysql
[root @ localhost ~] # wget http: / / dev mysql. com/Downloads/MySQL - 5.5 / mysql - 5.5.27. tar. gz decompression
[root@localhost ~]# cd /usr/local/[root@localhost local]# tar xzvf mysql-5.5.27.tar.gz[root@localhost local]# cd mysql-5.5.27
cmake run
[root@localhost mysql-5.5.27]# cmake .
Error:
-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH) CMake Error at cmake/readline.cmake:82 (MESSAGE): Curses library not found. Please install appropriate package, remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel. Call Stack (most recent call first): cmake/readline.cmake:126 (FIND_CURSES) cmake/readline.cmake:216 (MYSQL_USE_BUNDLED_LIBEDIT) CMakeLists.txt:250 (MYSQL_CHECK_READLINE) -- Configuring incomplete, errors occurred!
Solutions:
[root@localhost mysql-5.5.27]# rm CMakeCache.txt [root@localhost mysql-5.5.27]# yum -y install ncurses-devel*
Rerun cmake
[root @localhost mysql-5.5.27]# cmake. There is a warning
Warning: Bison executable not not found in PATH has 1 warning, also fixed it, lack Bison just install 1
[root@localhost mysql-5.5.27]# yum install bison
Run again without error
[root @localhost mysql-5.5.27]# cmake. Configuration options for installation can be set before compiling the installation
[root @localhost mysql-5.5.27]#./configure --help selects the options you need to set based on the help information, but you can also skip this step and go with the default Settings
Start compiling and installing, it takes a little bit longer...
[root @localhost mysql-5.5.27]# make && make install complete build and install
Go to the installation directory, change the ownership of program base 2 to root, change the ownership of data directory to mysql user, and update the authorization table
[root R mysql-5.5.27]# cd /usr/local root]# chown chgrp - R mysql. [root @ localhost mysql] # scripts/mysql_install_db - user = mysql initialize database [root @ localhost mysql] # / usr local/mysql/scripts/mysql_install_db - user = mysql basedir = / usr/local/mysql - datadir = / usr/local/start mysql mysql/data safety
[root @localhost mysql]#./bin/mysqld_safe --user=mysql close mysql
[root @localhost mysql]#./bin/ mysqladmin-u root shutdown-p] the default password is empty for easy call, Set a soft link for mysql [root @ localhost ~] # ln - s/usr/local/mysql/bin/mysql/usr/bin/mysql
Other Settings:
Set the options file and copy the configuration file under /etc
cnf /etc/mysql.cnf is set to start on the machine / etc init. d/mysql [root @ localhost mysql] # chmod + x/etc/init d/mysql [root @ localhost mysql] # chkconfig � add mysqld [root @ localhost mysql] # chkconfg mysqld on
You can now start and close the Mysql server via the service
[root@localhost ~]# service mysql start [root@localhost ~]# service mysql shutdown
Connect to server
[root@localhost ~]# mysql -u root -pyourpasswordWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 3 to server version: 5.5.27 Source distributinoType 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql
>
...mysql
>
The prompt tells you that mysql is ready to type the command for you.
So far, MySQL has been installed and is ready to use
mysql
>
QUIT