fedora 20ソースコードコンパイルインストールmysql-5.6.15

10032 ワード

fedora 20ソースコードコンパイルインストールmysql-5.6.15
私のはfedora 20、64ビットのシステムです.インストールされているのはmysqlの最新バージョン、mysql-5.6.15です.
http://dev.mysql.com/downloads/mysql/これはmysqlの公式ダウンロードアドレスで、登録アカウントが必要です.
これは公式のインストール説明です.
# Preconfiguration setup shell> groupadd mysql shell> useradd -r -g mysql mysql # Beginning of source-build specific instructions shell> tar zxvf mysql-VERSION.tar.gz shell> cd mysql-VERSION shell> cmake . shell> make shell> make install # End of source-build specific instructions # Postinstallation setup shell> cd/usr/local/mysql shell> chown -R mysql . shell> chgrp -R mysql . shell> scripts/mysql_install_db --user=mysql shell> chown -R root . shell> chown -R mysql data shell> bin/mysqld_safe --user=mysql & # Next command is optional shell> cp support-files/mysql.server/etc/init.d/mysql.server
私はこの説明に従ってインストールに成功しました.
1.ダウンロードしたソースパッケージmysql-5.6.15を解凍する.tar.gz
tar zxvf mysql-5.6.15.tar.gz
2.構成コンパイル
コンパイル最適化パラメータの設定
export CFLAGS="-O2 -mtune=native -march=native"
export CXXFLAGS="-O2 -mtune=native -march=native"
これは本機に対する最適化であり、移植性を保証するものではなく、他のホストで使用するために移植可能なパッケージを使用したい場合は、この書き込みオプションを追加しないでください.O 2を1つだけ使用すればよい.
mysqlはncursesライブラリに依存しており、インストールされていない場合はインストールする必要があります.
yum install ncurses-devel
cdはソースコードの解凍ディレクトリに入って構成を開始する
cmake . \-DCMAKE_INSTALL_PREFIX=/usr/local/mysql//インストールディレクトリ-DMYSQL_DATADIR=/usr/local/mysql/data//データディレクトリ-DSYSCOnFDIR=/etc//プロファイルmy.cnfのディレクトリ-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock                           //mysql.sockディレクトリ
その他のパラメータは、公式のドキュメントの説明を参照してください.http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.html
終わったら間違いなくできる
3.インストールが完了してから起動する必要がある
mysqlグループとmysqlユーザーを追加します.
[like@bogon mysql]$sudo groupadd mysql
[like@bogon mysql]$sudo useradd -r -g mysql mysql
mysqlへのインストールディレクトリ変更ディレクトリはmysqlの所有であり、グループもmysqlである.
[like@bogon mysql]$ sudo chown -R mysql . [like@bogon mysql]$ sudo chgrp -R mysql .
イニシャルデータ
[like@bogon mysql]$ sudo scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data
[like@bogon mysql]$  sudo scripts/mysql_install_db --user=mysql
Installing MySQL system tables...2014-01-19 20:11:12 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-01-19 20:11:12 19967 [Note] InnoDB: The InnoDB memory heap is disabled
2014-01-19 20:11:12 19967 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-01-19 20:11:12 19967 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-01-19 20:11:12 19967 [Note] InnoDB: Using Linux native AIO
2014-01-19 20:11:12 19967 [Note] InnoDB: Using CPU crc32 instructions
2014-01-19 20:11:12 19967 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-01-19 20:11:12 19967 [Note] InnoDB: Completed initialization of buffer pool
2014-01-19 20:11:12 19967 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2014-01-19 20:11:12 19967 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2014-01-19 20:11:12 19967 [Note] InnoDB: Database physically writes the file full: wait...
2014-01-19 20:11:12 19967 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2014-01-19 20:11:12 19967 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2014-01-19 20:11:13 19967 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2014-01-19 20:11:13 19967 [Warning] InnoDB: New log files created, LSN=45781
2014-01-19 20:11:13 19967 [Note] InnoDB: Doublewrite buffer not found: creating new
2014-01-19 20:11:13 19967 [Note] InnoDB: Doublewrite buffer created
2014-01-19 20:11:13 19967 [Note] InnoDB: 128 rollback segment(s) are active.
2014-01-19 20:11:13 19967 [Warning] InnoDB: Creating foreign key constraint system tables.
2014-01-19 20:11:13 19967 [Note] InnoDB: Foreign key constraint system tables created
2014-01-19 20:11:13 19967 [Note] InnoDB: Creating tablespace and datafile system tables.
2014-01-19 20:11:13 19967 [Note] InnoDB: Tablespace and datafile system tables created.
2014-01-19 20:11:13 19967 [Note] InnoDB: Waiting for purge to start
2014-01-19 20:11:13 19967 [Note] InnoDB: 5.6.15 started; log sequence number 0
2014-01-19 20:11:16 19967 [Note] Binlog end
2014-01-19 20:11:16 19967 [Note] InnoDB: FTS optimize thread exiting.
2014-01-19 20:11:16 19967 [Note] InnoDB: Starting shutdown...
2014-01-19 20:11:17 19967 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK

Filling help tables...2014-01-19 20:11:17 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-01-19 20:11:17 19990 [Note] InnoDB: The InnoDB memory heap is disabled
2014-01-19 20:11:17 19990 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-01-19 20:11:17 19990 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-01-19 20:11:17 19990 [Note] InnoDB: Using Linux native AIO
2014-01-19 20:11:17 19990 [Note] InnoDB: Using CPU crc32 instructions
2014-01-19 20:11:17 19990 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-01-19 20:11:17 19990 [Note] InnoDB: Completed initialization of buffer pool
2014-01-19 20:11:17 19990 [Note] InnoDB: Highest supported file format is Barracuda.
2014-01-19 20:11:17 19990 [Note] InnoDB: 128 rollback segment(s) are active.
2014-01-19 20:11:17 19990 [Note] InnoDB: Waiting for purge to start
2014-01-19 20:11:18 19990 [Note] InnoDB: 5.6.15 started; log sequence number 1625977
2014-01-19 20:11:18 19990 [Note] Binlog end
2014-01-19 20:11:18 19990 [Note] InnoDB: FTS optimize thread exiting.
2014-01-19 20:11:18 19990 [Note] InnoDB: Starting shutdown...
2014-01-19 20:11:19 19990 [Note] InnoDB: Shutdown completed; log sequence number 1625987
OK

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:

  ./bin/mysqladmin -u root password 'new-password'
  ./bin/mysqladmin -u root -h bogon password 'new-password'

Alternatively you can run:

  ./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 . ; ./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 with the ./bin/mysqlbug script!

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 ./my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings

データフォルダの所有者とグループをmysqlに変更[like@bogon mysql]$ sudo chown -R root . [like@bogon mysql]$ sudo chown -R mysql data
mysqlデータベースを起動できます.
sudo support-files/mysql.server start
次のように正常に起動しました.
[kuaile@localhost mysql]$ sudo support-files/mysql.server start
Starting MySQL.                                            [      ]

mysql.serverはシステムの対応するディレクトリにコピーすると、mysqlを自動的に起動します.
cp support-files/mysql.server/etc/init.d/mysql.server
4.インストール完了後mysqlデータベースのrootユーザーはパスワードがないので、自分でパスワードを設定する必要があります.
  ./bin/mysqladmin-u root password'new-password'//本機実行用
  ./bin/mysqladmin-u root-h bogon password'new-password'//非本機
この二人は一つ成功すればいい.
新passwordは新しいパスワードです.
この新しいパスワードでmysqlデータベースに接続できます
mysqlはセキュリティ設定を持っています.
このコマンドを実行
sudo ./bin/mysql_secure_installation
ヒントに従ってyes or noに答えてセキュリティ設定を完了
 sudo ./bin/mysql_secure_installation



NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] n
 ... skipping.

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] n
 ... skipping.

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!




All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!


Cleaning up...