MySQL Installation documentation

Source: Internet
Author: User

MySQL in work may be installed in two operating systems, Windows and Linux. The majority of the Linux system.

Install on Windows systems the same as other Windows applications follow the installation Wizard The next step is that this is not specifically described here, this document only describes the installation steps of MySQL under the Linux system.

Linux There are three types of MySQL installed in the system: RPM package Installation, binary package installation and source package installation. Binary package installation is not commonly used, here is not introduced (in fact, I did not install in this way), the other two installation methods, RPM package installation operation is simple, high success rate, but can not be installed at the installation of any settings can only use the default settings; The source package installation operation is complex, due to the installation of MySQL system to compile first, After the successful compilation can be installed, often in the compilation of this link prone to problems, such as the dependent system library files are not found, so the success rate is lower than the RPM package, but the source package installation can be set up a lot of system configuration parameters, which increases the flexibility of many installations. The specific choice of which installation method to install depends on the specific needs.

First, download the installation program

MySQL All versions can be downloaded from the official website, generally we use the Community Server version. If you choose source installation, the latest version of MySQL5.5 is now compiled with the CMake compiler. corresponding to the following:

MySQL official:http://dev.mysql.com/downloads/

Cmake compiler organ:http://wwwNaNake.org/cmake/resources/software.html

Second, RPM Package Installation

RPM Package Installation There is nothing to set up to run the installation command directly:

RPM–IVH mysql-server-version number. RPMRPM–IVH mysql-client-version number. rpm

Third, the source package installation

Assuming that the packages are downloaded to the/root/software directory

1. Installing the Cmame compiler

CD/ROOT/SOFTWARETAR-ZXVF cmake-2.8.8.tar.gzcd Cmake-2.8.8./bootstrapgmakegmake Install

2. install MySQL

(1) build MySQL users and Groups

/usr/sbin/groupadd mysql/usr/sbin/useradd-g MySQL MySQL

(2) Check the configuration of the MySQL installation environment

cd /root/softwaretar -zxvf mysql-5.5.23.tar.gzcd  mysql-5.5.23/cmake -dcmake_install_prefix=/usr/local/mysql\     (mysql installation path)-DMYSQL_ unix_addr=/tmp/mysql.sock \     (socket file storage path)-ddefault_charset=utf8 \         (default character Set)-ddefault_collation=utf8_general_ci -dwith_extra_charsets: String=utf8,gbk -dwith_myisam_storage_engine=1 -dwith_innobase_storage_engine=1 -dwith_readline =1 -denabled_local_infile=1 -dmysql_datadir=/home/mysql/data     (data store path) if Error: no curses/termcap library found appears when checking the installation environment, you can add the following to the parameters above to specify   Libncurses.so the library file to be set according to the actual location of your library file:-dcurses_library=/lib64/libncurses.so.5 -dcurses_include_path=/usr/ Include 

(3) compiling MySQL source package

Make at compile time if appears: attempted static link of dynamic object '/usr/lib/libncurses.so.5 ' error, should be libncurses.so Library file Specifies the path is not correct, find the next libncurses.so library file storage location, the correct designation can:-dcurses_library=/lib64/libncurses.so.5-dcurses_ Include_path=/usr/include

(4) install MySQL

Make install

3. Configure MySQL

(1) Creating directory and connection library files

Mkdir-p/home/mysql/mkdir-p/home/mysql/data/mkdir-p/var/mysql/log/ln-s/usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18

(2) MySQL- related directory to MySQL users

chmod +w/usr/local/mysqlchown-r mysql:mysql/usr/local/mysqlchown-r mysql:mysql/home/mysql/

(3) setting up the configuration file and startup file

CD SUPPORT-FILESCP my-large.cnf/etc/my.cnf (Note: MY-LARGE.CNF is suitable for servers with around 1G memory and can be selected MY-LARGE.CNF or MY-HUGE.CNF according to your own configuration different configurations) CP Mysql.server/etc/init.d/mysqld

(4) Configuring startup Files

chmod +x/etc/init.d/mysqldvim/etc/init.d/mysqld (edit this file to find and modify the following variable contents:) basedir=/usr/local/mysqldatadir=/home/mysql/ Data

(5) initializing MySQL database

/usr/local/mysql/scripts/mysql_install_db--defaults-file=/etc/my.cnf \ (configuration file path)--basedir=/usr/local/mysql \ (M Ysql Main program installation path)--datadir=/home/mysql/data \ (data store path)--user=mysql

4. start MySQL

Service mysqld start or/etc/ini.d/mysqld start

5. set MySQL access rights

(1) to set a password for the root user

/usr/local/mysql/bin/mysqladmin-u root password ' newpassword '

(2) set allow remote access to users

Mysql-u root-ppasswordmysql> Grant all privileges on * * to ' root ' @ '% ' identified by ' password ' with Grant OPTION;MYSQ l> Flush Privileges;mysql> quit

Iv. encountered problems and more information

The above is my installation of MySQL and some of the problems encountered (in the rhel6.1x64 system), but in different system environment may encounter different problems, when encountering problems when more Internet search data, generally will find a solution to the Internet such a good resource pool we have to make good use of.

This article is from "Levy" blog, please make sure to keep this source http://liyong0802.blog.51cto.com/2574432/1679023

MySQL Installation documentation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.