Compile and install MySQL in Linux
Recently I want to develop Hadoop, install MySQL, and test sqoop. Since MySQL is open source code, install it in source code.
The following describes my test environment:
VMware10 + Ubuntu14.04 Kylin
Next, let's start writing the code step by step (unless specifically stated, it is executed by the root user ):
1. Download The MariaDB source code: https://downloads.mariadb.org/mariadb/10.0.14/. download the downloaded file: mariadb-10.0.14.tar.gz
2. install cmake: apt-get install cmake. the ubuntu source may not be the latest cmake version, but it can be used. If you want to install cmake in the source code, refer to search engine.
3. Some Dependent packages are installed, but I haven't figured out the specific needs yet, But libaio-dev is to be installed, and others can be searched.
4 decompress the source package, I decompress the path is:/root/mariadb-10.0.14/, enter the path, enter the following command:
Cmake.-DCMAKE_INSTALL_PREFIX =/usr/mysql-DMYSQL_DATADIR =/home/mysql/data-DDEFAULT_CHARSET = utf8-DDEFAULT_COLLATION = utf8_general_ci-DEXTRA_CHARSETS = all
Modify the path according to your plan.
5. This is not a long time. However, if you are prompted to check the error log, the dependency package is generally missing and you can search for related errors and install the dependency.
6. If an error occurs, you must delete the CMakeCache file during re-compilation.
7. If no error is prompted, enter "make" and then "make install. Make takes a long time. During this period, many warnings are prompted, so ignore them directly.
8. After the above steps are completed, the installation is completed, and the database can be initialized below. Change the/usr/mysql owner to mysql. Log on to/usr/mysql/support_files and run
Cp my-large.cnf/etc/my. cnf
Cp mysql. server/etc/init. d/mysql
Modify/etc/my. cnf and add the following statement:
Tmpdir =/home/mysql/tmp/
Basedir =/usr/mysql
Datadir =/home/mysql/data
Note that you need to create a directory and change the owner to mysql.
Modify/etc/init. d/mysql and change the values of basedir and datadir to the planned directory.
9. Enter/usr/mysql/script and execute the following statement:
./Mysql_install_db -- user = mysql -- basedir =/usr/mysql -- datadir =/home/mysql/data
After execution, you will be prompted to modify/etc/profile and add the PATH variable: export PATH = $ PATH:/usr/mysql/bin.
Run source/etc/profile
10 start mysql service: service mysql start
11 run: mysqladmin-u root password 'root'
12. Then, install mysql and run mysql-uroot-proot to access the mysql command line.
This process is also applicable to mysql, because mariaDB itself is no different from mysql.
-------------------------------------- Split line --------------------------------------
Install MySQL in Ubuntu 14.04
MySQL authoritative guide (original book version 2nd) Clear Chinese scan PDF
Ubuntu 14.04 LTS install LNMP Nginx \ PHP5 (PHP-FPM) \ MySQL
Build a MySQL Master/Slave server in Ubuntu 14.04
Build a highly available distributed MySQL cluster using Ubuntu 12.04 LTS
Install MySQL5.6 and Python-MySQLdb in the source code of Ubuntu 12.04
MySQL-5.5.38 universal binary Installation
-------------------------------------- Split line --------------------------------------
This article permanently updates the link address: