Compile and install the latest mysql version in LINUX

Source: Internet
Author: User
Tags check character

Compile and install the latest version in LINUX. mysql 1.download and install mysql-5.30.tar.gzand cmake.2.8.11.2.tar.gz (1) install cmake first (after mysql5.5 is compiled through cmake) [root @ rhel5 local] # tar-zxv-f cmake-2.8.11.2.tar.gz [root @ rhel5 local] # cd cmake-2.8.11.2 [root @ rhel5 cmake-2.8.4] #. /configure [root @ rhel5 cmake-2.8.4] # make [root @ rhel5 cmake-2.8.4] # make install the Cannot find appropriate C ++ compiler on this system error message may appear in the configure cmake Process, the c ++ compiler is missing, so yum is installed. -Y install gcc-c ++ (2) Create the mysql installation directory and database storage directory [root @ rhel5 ~] # Mkdir-p/usr/local/mysql // install mysql [root @ rhel5 ~] # Mkdir-p/usr/local/mysql/data // store the database (3) create a mysql user and user group [root @ rhel5 ~] Groupadd mysql [root @ rhel5 ~] Useradd-r-g mysql (4) install mysql [root @ rhel5 local] # tar-zxv-f mysql-5.5.30.tar.gz [root @ rhel5 local] # cd mysql-5.5.30 [root @ rhel5 mysql-5.5.10] # cmake. -DCMAKE_INSTALL_PREFIX =/usr/local/mysql-DMYSQL_DATADIR =/usr/local/mysql/data-DDEFAULT_CHARSET = utf8 (optional)-DDEFAULT_COLLATION = utf8_general_ci (optional) -DEXTRA_CHARSETS = all-DENABLED_LOCAL_INFILE = 1 [root @ rhel5 mysql-5.5.10] # make [root @ rhel5 mysql-5.5. 10] # make install parameter description: -DCMAKE_INSTALL_PREFIX =/usr/local/mysql // installation directory-DINSTALL_DATADIR =/usr/local/mysql/data // database storage directory-DDEFAULT_CHARSET = utf8/use the utf8 character-DDEFAULT_COLLATION = utf8_general_ci // check character-DEXTRA_CHARSETS = all // install all extended character sets-DENABLED_LOCAL_INFILE = 1 // considerations for importing data locally: during re-compilation, you need to clear the old object file and cache information. # Make clean # rm-f CMakeCache.txt # rm-rf/etc/my. cnf 2. Configure (1) Set directory permissions [root @ rhel5 ~] # Cd/usr/local/mysql [root @ rhel5 mysql] # chown-R root: mysql. // set the owner of all files in the current directory to root and the group to mysql [root @ rhel5 mysql] # chown-R mysql: mysql data (2) [root @ rhel5 mysql] # cp support-files/my-medium.cnf/etc/my. cnf // Add the mysql startup service to the System Service (3) create a table in the system database [root @ rhel5 mysql] # cd/usr/local/mysql [root @ rhel5 mysql] # scripts/mysql_install_db -- user = mysql // This is required, this is the initialization of the database, otherwise many warnings and errors will be prompted (4) set the environment variable [root @ rhel5 ~] # Vi/root /. bash_profile In PATH = $ PATH: $ HOME/bin Add the parameter: PATH = $ PATH: $ HOME/bin:/usr/local/mysql/bin: /usr/local/mysql/lib [root @ rhel5 ~] # Source/root/. bash_profile (5) manually start mysql [root @ rhel5 ~] # Cd/usr/local/mysql [root @ rhel5 mysql] #. /bin/mysqld_safe -- user = mysql & // start MySQL, but the startup log cannot be stopped and written under this file:/usr/local/mysql/data/localhost. err (all information prompted during mysql startup, including error information) close the MySQL service [root @ rhel5 mysql] # mysqladmin-u root-p shutdown // The MySQL root User has not configured a password, so it is null. When you need to enter the password, click the Enter key. (6) Another simple method for starting mysql (mysql has been added to the system service) [root @ rhel5 ~] # Service mysql. server start [root @ rhel5 ~] # Service mysql. server stop [root @ rhel5 ~] # Service mysql. server restart if the preceding command appears: mysql. if the server does not recognize other services, mysql may not be added to the system service. Next, use another method to add: [root @ rhel5 mysql] # cp support-files/mysql. server/etc/init. d/mysql // Add the mysql startup service to the system service. Note: mysql is mainly used. server copy to/etc/init. d, named mysql. In some systems, mysql. server in/usr/local/mysql/share/mysql. server, and mysql in the system. server in/usr/local/mysql/support-files/mysql. server. Then start mysql with # service mysql start. (7) modify the password of the root user of MySQL and open the remote connection [root @ rhel5 ~] # Mysql-u root mysql> use mysql; mysql> desc user; mysql> grant all privileges on *. * TO root @ "%" identified by "root"; // Add the remote connection capability TO the root user. Mysql> update user set Password = password ('xxxxxx') where User = 'root'; mysql> select Host, User, Password from user where User = 'root '; mysql> flush privileges; mysql> exit to log on again: mysql-u root-p if remote connection is not available, disable firewall [root @ rhel5 ~] #/Etc/rc. d/init. d/iptables stop Note: If the remote connection fails and the mysql error number 1130 is displayed, add the following statement: mysql> grant all privileges on *. * TO 'root' @ '%' identified by '******' with grant option;

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.