How to install MySQL using Yum:
Yum install mysql-Server
Because yum is accidentally deleted. Therefore, it is forced to install the SDK using commands.
The latest MySQL versions require cmake compilation and installation. It is estimated that this method will be used in future versions. Therefore, we will record the installation steps and procedures for your reference.
Note:The latest toolkit has been installed in centos by default. For example:GNU make,Gcc,Perl,Libncurses5-devIf a missing toolkit is found during compilation and installationYum
InstallDownload, install, and continue.
The following installation involves several issues that need to be explained in advance:
1. All downloaded files will be saved in the/usr/local/src/directory.
2. MySQL will run as a MySQL user, and will automatically run after the service is started.
3. MySQL will be installed in the/usr/local/MySQL/directory.
4. MySQL uses the utf8 character set by default.
5. Mysql Data and log files are stored in the/var/MySQL/directory.
6. Save the MySQL configuration file to/etc/My. CNF.
1. Use wget to download the required software from centos and save it to the/usr/local/src/directory.
Wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.17.tar.gz/from/http://mysql.ntu.edu.tw/
Wget www.cmake.org/files/v2.8/cmake-2.8.6.tar.gz
Wget http://ftp.gnu.org/gnu/bison/bison-2.5.tar.gz
Ii. Install cmake
CD/usr/local/src
Tar zxvf cmake-2.8.4.tar.gz
CD cmake-2.8.4
./Bootstrap
Make
Make install
CD ../
Tar zxvf bison-2.5.tar.gz
CD bison-2.5
./Configure
Make
Make install
CD ../
Iii. Compile and install MySQL 5.5.13
/Usr/sbin/groupadd MySQL
/Usr/sbin/useradd-G MySQL
Tar xvf mysql-5.5.15.tar.gz
CD mysql-5.5.15/
Mkdir-P/usr/local/MySQL
Chmod + w/usr/local/MySQL
Chown-r MYSQL: MySQL/usr/local/MySQL
Mkdir-P/var/MySQL/
Mkdir-P/var/MySQL/data/
Mkdir-P/var/MySQL/log/
Chown-r MYSQL: MySQL/var/MySQL/
Cmake-dcmake_install_prefix =/usr/local/MySQL \
-Dmysql_unix_addr =/tmp/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 =/var/MySQL/data \
-Dmysql_user = MySQL
If cmake reports an error, delete Rm-RF cmakecache.txt first.
Run Yum-y install ncurses-devel
Make
Make install
Ln-S/usr/local/MySQL/lib/libmysqlclient. so.16/usr/lib/libmysqlclient. so.16
CD support-files/
CP my-large.cnf/etc/My. CNF
CP mysql. Server/etc/init. d/mysqld
4. Configure to start MySQL 5.5.15
1. If necessary, first modify MySQL configuration my. CNF
VI/etc/My. CNF
Built-in optimizations, such as connections, InnoDB, and MyISAM.
2. MySQL initialization and Installation
/Usr/local/MySQL/scripts/mysql_install_db \
-- Defaults-file =/etc/My. CNF \
-- Basedir =/usr/local/MySQL \
-- Datadir =/var/MySQL/data \
-- User = MySQL
3. Add MySQL to start up
Chmod + x/etc/init. d/mysqld
VI/etc/init. d/mysqld (edit this file, find and modify the following variable content :)
Basedir =/usr/local/MySQL
Datadir =/var/MySQL/Data
Chkconfig -- add mysqld
Chkconfig -- level 345 mysqld on
4. Start MySQL
Service mysqld start
5. Password Change
Update user SET Password = PASSWORD ('Password') where user = 'root ';
Flush privileges;
6. Client encoding method change
Show variables like 'character _ SET _ % ';
Setcharacter_set_client = utf8;