標籤:安裝 mysql
今天來寫寫MySQL 5.6.19的編譯安裝,現在5.6版本的安裝比較發雜一點了,不扯了開始吧!
安裝環境
OS:Cent OS 6.5
軟體:Mysql 5.6.19
下載軟體
http://mirrors.sohu.com/mysql/MySQL-5.6/Mysql-5.6.19.tar.gz
安裝前環境配置
#yum install -y lrzsz (這個軟體可以上傳檔案) #rz (找到你剛才下載的mysql) #yum groupinstall development tools server platform development desktop platform developkment (安裝編譯環境) #yum install -y cmake #yum install -y ncurses-devel #useradd -r mysql #mkdir -p /usr/local/mysql #mkdir -p /mysql/data #tar xf mysql-5.6.19.tar.gz #cd mysql-5.6.19 #cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/mysql/data
Check size of pthread_t
-- Check size of pthread_t - done
-- Using cmake version 2.6.4
-- Not building NDB
-- Performing Test HAVE_PEERCRED
-- Performing Test HAVE_PEERCRED - Success
-- Library mysqlclient depends on OSLIBS -lpthread;m;rt;dl
-- Googlemock was not found. gtest-based unit tests will be disabled. You can run cmake . -DENABLE_DOWNLOADS=1 to automatically download and build required components from source.
-- If you are inside a firewall, you may need to use an http proxy: export http_proxy=http://example.com:80
-- Library mysqlserver depends on OSLIBS -lpthread;m;rt;crypt;dl
-- Configuring done
-- Generating done
-- Build files have been written to: /mydata/software/mysql-5.6.19
(看到以上資訊說明編譯前的配置成功)
#make && make install
-- Installing: /usr/local/mysql/man/man1/mysql_fix_extensions.1
-- Installing: /usr/local/mysql/man/man1/mysqlaccess.1
-- Installing: /usr/local/mysql/man/man1/my_print_defaults.1
-- Installing: /usr/local/mysql/man/man1/mysqltest.1
-- Installing: /usr/local/mysql/man/man1/myisam_ftdump.1
-- Installing: /usr/local/mysql/man/man1/comp_err.1
-- Installing: /usr/local/mysql/man/man1/mysql_upgrade.1
-- Installing: /usr/local/mysql/man/man1/mysql_setpermission.1
-- Installing: /usr/local/mysql/man/man1/mysql_config_editor.1
-- Installing: /usr/local/mysql/man/man1/mysqlshow.1
-- Installing: /usr/local/mysql/man/man1/mysql_find_rows.1
-- Installing: /usr/local/mysql/man/man1/mysql_convert_table_format.1
-- Installing: /usr/local/mysql/man/man1/resolveip.1
-- Installing: /usr/local/mysql/man/man1/mysqladmin.1
-- Installing: /usr/local/mysql/man/man1/resolve_stack_dump.1
-- Installing: /usr/local/mysql/man/man1/replace.1
-- Installing: /usr/local/mysql/man/man1/mysqldump.1
-- Installing: /usr/local/mysql/man/man1/perror.1
-- Installing: /usr/local/mysql/man/man1/mysql.server.1
-- Installing: /usr/local/mysql/man/man1/mysql_install_db.1
-- Installing: /usr/local/mysql/man/man1/myisamlog.1
-- Installing: /usr/local/mysql/man/man1/mysql_config.1
-- Installing: /usr/local/mysql/man/man1/mysqlslap.1
-- Installing: /usr/local/mysql/man/man1/mysqlhotcopy.1
-- Installing: /usr/local/mysql/man/man8/mysqld.8
(看到上面資訊說明編譯安裝成功)
配置MySQL設定檔
#cd /usr/local/mysql #ll
total 156
drwxr-xr-x 2 root root 4096 May 14 14:36 bin
-rw-r--r-- 1 root root 17987 May 6 18:45 COPYING
drwxr-xr-x 3 root root 4096 May 14 14:29 data
drwxr-xr-x 2 root root 4096 May 14 14:29 docs
drwxr-xr-x 3 root root 4096 May 14 14:29 include
-rw-r--r-- 1 root root 89163 May 6 18:46 INSTALL-BINARY
drwxr-xr-x 3 root root 4096 May 14 14:29 lib
drwxr-xr-x 4 root root 4096 May 14 14:36 man
drwxr-xr-x 10 root root 4096 May 14 14:36 mysql-test
-rw-r--r-- 1 root root 2496 May 6 18:45 README
drwxr-xr-x 2 root root 4096 May 14 14:36 scripts
drwxr-xr-x 28 root root 4096 May 14 14:36 share
drwxr-xr-x 4 root root 4096 May 14 14:36 sql-bench
drwxr-xr-x 2 root root 4096 May 14 14:36 support-files
#vim /etc/profile (添加如下內容到最後一行) export PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH #. /etc/profile (重讀設定檔)
#chown -R root:mysql /usr/local/mysql/* #chown -R mysql:msyql /mysql/data (修改檔案的屬主和屬主)
#cd /usr/local/mysql/support-files #mv /etc/my.cnf /etc/my.cnf.bak #cp my-default.cnf /etc/my.cnf #cp mysql.server /etc/rc.d/init.d/msyqld #chkconfig --add mysqld #chkconfig msyql on #./usr/local/mysql/scripts/msyql_install_db --user=mysql --datadir=/mysql/data --basedir=/usql/local/mysql
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/local/mysql/bin/mysqladmin -u root password ‘new-password‘
/usr/local/mysql/bin/mysqladmin -u root -h localhost.localdomain password ‘new-password‘
Alternatively you can run:
/usr/local/mysql/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; /usr/local/mysql/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
Please report any problems at http://bugs.mysql.com/
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as /usr/local/mysql/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings
WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server
(看到上面內容說明初始化msyql成功)
#service msyqld start
Starting MySQL................................. [ OK ]
到此編譯完成!
本文出自 “linux” 部落格,請務必保留此出處http://wuguohua2014.blog.51cto.com/660821/1532580