Compile and install Ubuntu-12.04.2 on MySQL-5.6.10 [Installation notes] Ubuntu
BitsCN.com
Compile and install the Ubuntu-12.04.2 on the MySQL-5.6.10 [Installation notes]
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/var/mysql/my. cnf.
1: Download and install the library required for MySQL source code compilation
Sudo apt-get install build-essential libncurses5-dev cmake
2: Download and decompress the MySQL source package
Cd/usr/local/src/
Sudo wget-O mysql-5.6.10.tar.gz http://www.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.10.tar.gz/from/http://cdn.mysql.com/
Sudo tar-zxvf mysql-5.6.10.tar.gz
Sudo/usr/sbin/groupadd mysql
Sudo/usr/sbin/useradd-g mysql
Sudo mkdir-p/var/mysql/
Sudo mkdir-p/var/mysql/data/
Sudo mkdir-p/var/mysql/log/
Sudo chmod 777/var/mysql/data
3: Use cmake to generate the installation file
Cd mysql-5.6.10
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-DWITH_MYISAM_STORAGE_ENGINE = 1-DWITH_INNOBASE_STORAGE_ENGINE = 1-DWITH_READLINE = 1-DENABLED_LOCAL_INFILE = 1-DMYSQL_DATADIR =/var/mysql/data
4. install MySQL
Sudo make
Sudo make install
Sudo chmod + w/usr/local/mysql
Sudo chown-R mysql: mysql/usr/local/mysql
Sudo chown-R mysql: mysql/var/mysql/
Sudo ln-s/usr/local/mysql/lib/libmysqlclient. so.18/usr/lib/libmysqlclient. so.18
Sudo cp my-default.cnf/var/mysql/my. cnf)
Sudo cp mysql. server/etc/init. d/mysqld
4. configure to start MySQL 5.6.10
1. if necessary, first modify mysql configuration my. cnf
Vi/var/mysql/my. cnf
2. mysql initialization and installation
/Usr/local/mysql/scripts/mysql_install_db/
-- Defaults-file =/var/mysql/my. cnf/
-- Basedir =/usr/local/mysql/
-- Datadir =/var/mysql/data/
-- User = mysql
Line
Sudo/usr/local/mysql/scripts/mysql_install_db -- defaults-file =/var/mysql/my. cnf -- basedir =/usr/local/mysql -- datadir =/var/mysql/data -- user = mysql
3. add mysql to start up
Sudo chmod + x/etc/init. d/mysqld
Vi/etc/init. d/mysqld (sudo vim/etc/init. d/mysqld edit this file, find and modify the following variable content :)
Basedir =/usr/local/mysql
Datadir =/var/mysql/data
Save and exit
Sudo chkconfig -- add mysqld
========================================================== ===
Error:
Sudo: chkconfig: command not found
Fixed:
Sudo apt-get install chkconfig
========================================================== ===
Sudo chkconfig -- level 345 mysqld on
========================================================== ===
Error:
/Sbin/insserv: no file or directory
Fixed:
Sudo ln-s/usr/lib/insserv/sbin/insserv
========================================================== ===
/Usr/local/mysql/bin/mysqladmin-u root password new password
Eg ==> sudo/usr/local/mysql/bin/mysqladmin-u root password 123456
========================================================== ===
Error:
/Usr/local/mysql/bin/mysqladmin: connect to server at 'localhost' failed
Error: 'Can't connect to local MySQL server through socket '/tmp/mysql. sock' (2 )'
Check that mysqld is running and that the socket: '/tmp/mysql. sock' exists! Fixed:
Fixed: (This is because the system has a mysql Zombie process, which can be killed or restarted)
Reboot
========================================================== ===
Sudo ln-s/usr/local/mysql/bin/mysql/usr/bin/mysql
Test:
Mysql-u root-p
4. start mysql
Sudo service mysqld restart
// At this point, the installation is complete
BitsCN.com