Install essential tools compile installation requires support from other installation programs, it is recommended to install a variety of required packages, here for convenience, the use of ubuntu provided apt-getinstall method to install the required tool sudoapt-getinstallcmakelibncurses5-devbisongbuild-essentialchkconfig after installation is complete, you can start mysql
Installation of necessary tools requires the support of other installation programs. We recommend that you compile and install various required packages for convenience, use the apt-get install method provided by ubuntu to install the required tool sudo apt-get install cmakelibncurses5-dev bisong build-essential chkconfig after installation is complete, you can start mysql
Install required tools
Compilation and installation require the support of other installation programs. We recommend that you compile and install various required packages. For convenience, use the apt-get install method provided by ubuntu to install the required tools.
Sudo apt-get install cmakelibncurses5-dev bisong ++ build-essential chkconfig
After installation, you can start the mysql compilation and installation process;
Add a user group and create a new installation directory
Add a mysql user group
Sudo groupadd mysql
Create a mysql user and add it to the mysql group. mysql users are not allowed to log on to the system directly.
Sudu useradd-r-g mysql-s/bin/false
Create the mysql installation directory. It is recommended that all installation program directories be in the/usr/local/directory to facilitate management and future maintenance.
Sudo mkdir-p/usr/local/mysql
Create a data installation directory for mysql
Sudo mkdir-p/usr/local/mysql/data
Grant all permissions to the data directory and files in it to the mysql user
Sudo chown-Rmysql: mysql/usr/local/mysql/data
Compile and install mysql
Download the latest installation package from mysqlofficial network. The downloaded package is mysql-5.6.16.tar.gz. It is best to put all the installation packages under the same directory. I prefer to put them under the/var/opt/directory. Of course, you 'd better put them under the/opt/directory and,
Sudo tar-zxvf mysql-5.6.16.tar.gz
Cd mysql-5.6.16
Sudo 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-cores = 1-DWITH_INNOBASE_STORAGE_ENGINE = 1-DWITH_MEMORY_STORAGE_ENGINE = 1-DWITH_READLINE = 1-DENABLED_LOCAL_INFILE = 1-DMYSQL_DATADIR =/usr/local/mysql/data
Start compilation and Installation
The sudo make-j 8 #-j number indicates that the task is run with multiple cores. The-j number is not added in the single-core State. The i5 processor can use-j 8 to speed up the compilation process.
Sudo make install
The installation has been basically completed since then
Configure mysql
Sudo ln-s/usr/local/mysql/bin/mysql/usr/bin/mysql
Sudo cp./support-files/my-default.cnf/etc/my. cnf
Sudo cp./support-files/mysql. server/etc/init. d/mysqld # Add Mysql to the system to start
Sudo chmod + x/etc/init. d/mysqld
Sudo chkconfig mysqld on
Initialize Installation
Sudo/usr/local/mysql/scripts/mysql_install_db -- defaults-file =/etc/my. cnf -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data -- user = mysql
Mysql installation has been completed since then
Set the mysql logon Password
You can use sudo/usr/local/mysql/bin/mysql to start mysql.
Set the password. newpaassword indicates the new password;
Sudo/usr/local/mysql/bin/mysqladmin-u root password newpassword
Test whether mysql is successfully installed.
Add mysql to Environment Variables
By adding mysql to environment variables, you can directly enter mysql into the database by entering mysql in the command line,
Echo "export PATH =/usr/local/mysql/bin: $ PATH">/etc/profile
Mysql-u root-p
If the password is successfully entered, mysql is successfully installed.