======= 利用源碼安裝的tar包,免安裝--MySQL-5.6.23 for CentOS6.5_64bit===@guoyJoe,centos6.5mysql

來源:互聯網
上載者:User

======= 利用源碼安裝的tar包,免安裝--MySQL-5.6.23 for CentOS6.5_64bit===@guoyJoe,centos6.5mysql

轉載請註明出處:http://blog.csdn.net/guoyjoe/article/details/44836547



一、在源碼安裝的基礎上:我打了一個tar包:
cd /u01/myss06
tar cvzf my3306.tar .


二、關閉防火牆
chkconfig iptables off 
service iptables stop 


vi /etc/selinux/config
SELINUX=disabled


三、檢查作業系統上是否安裝了MySQL
[root@mydb1 backup]# rpm -qa |grep mysql
qt-mysql-4.6.2-26.el6_4.x86_64
mysql-5.1.71-1.el6.x86_64
mysql-server-5.1.71-1.el6.x86_64
mysql-devel-5.1.71-1.el6.x86_64
mysql-libs-5.1.71-1.el6.x86_64


四、刪除MyQL(redhat6.3伺服器內建的mysql-libs是mysql-libs-5.1.61-4.el6.x86_64,可能會和高版本的mysql-libs有衝突)
yum remove mysql-libs


五、確定MySQL相關包徹底刪除
[root@mydb1 backup]# rpm -qa |grep mysql


六、添加使用者和組:
id mysql
userdel -r mysql
groupadd  mysql #增加使用者組
useradd -d /home/mysql -g mysql mysql


七、配MySQL環境變數
su - mysql
vi .bash_profile
PATH=$PATH:$HOME/bin:/u01/my3306/bin


source .bash_profile




八、解壓
cd /u01/my3306
tar -zxvf my3306.tar




九、在日誌中會報RSA報如下錯:


RSA private key file not found: /u01/my3306/data//private_key.pem. Some authentication plugins will not work.
RSA public key file not found: /u01/my3306/data//public_key.pem. Some authentication plugins will not work.


解決方案:

1. 檢查是否安裝openssl
$rpm -qa openssl
openssl-1.0.0-20.el6_2.5.x86_64


2.利用openssl產生公有和私人key
$ openssl genrsa -out mykey.pem 1024
Generating RSA private key, 1024 bit long modulus
..........++++++
.++++++
e is 65537 (0x10001)




$ openssl rsa -in mykey.pem -pubout -out mykey.pub
writing RSA key


$ ll mykey*          
[root@mydb1 my3306]# ll mykey* 
-rwxr-xr-x 1 root root 891 Apr  1 20:35 mykey.pem
-rwxr-xr-x 1 root root 272 Apr  1 20:35 mykey.pub


十、初始化MySQL指令碼
./scripts/mysql_install_db  --defaults-file=/u01/my3306/my.cnf --datadir=/u01/my3306/data --user=mysql


十一、啟動mysql
vi .bash_profile   ---root使用者下添加
PATH=$PATH:$HOME/bin:/u01/my3306/bin


mysqld_safe --defaults-file=/u01/my3306/my.cnf --user=mysql &


[root@mydb3 ~]# su - mysql
[mysql@mydb3 ~]$ mysql -h127.0.0.1 -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.23-log Source distribution


Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.15 sec)


mysql> show variables like '%log%';
+-----------------------------------------+-------------------------------------+
| Variable_name                           | Value                               |
+-----------------------------------------+-------------------------------------+
| back_log                                | 900                                 |
| binlog_cache_size                       | 32768                               |
| binlog_checksum                         | CRC32                               |
| binlog_direct_non_transactional_updates | OFF                                 |
| binlog_error_action                     | IGNORE_ERROR                        |
| binlog_format                           | ROW                                 |
| binlog_gtid_simple_recovery             | OFF                                 |
| binlog_max_flush_queue_time             | 0                                   |
| binlog_order_commits                    | ON                                  |
| binlog_row_image                        | FULL                                |
| binlog_rows_query_log_events            | OFF                                 |
| binlog_stmt_cache_size                  | 32768                               |
| binlogging_impossible_mode              | IGNORE_ERROR                        |
| expire_logs_days                        | 7                                   |
| general_log                             | OFF                                 |
| general_log_file                        | /u01/my3306/data/mydb3.log          |
| innodb_api_enable_binlog                | OFF                                 |
| innodb_flush_log_at_timeout             | 1                                   |
| innodb_flush_log_at_trx_commit          | 1                                   |
| innodb_locks_unsafe_for_binlog          | OFF                                 |
| innodb_log_buffer_size                  | 67108864                            |
| innodb_log_compressed_pages             | ON                                  |
| innodb_log_file_size                    | 1048576000                          |
| innodb_log_files_in_group               | 4                                   |
| innodb_log_group_home_dir               | /u01/my3306/log/iblog               |
| innodb_mirrored_log_groups              | 1                                   |
| innodb_online_alter_log_max_size        | 134217728                           |
| innodb_undo_logs                        | 128                                 |
| log_bin                                 | ON                                  |
| log_bin_basename                        | /u01/my3306/log/binlog/binlog       |
| log_bin_index                           | /u01/my3306/log/binlog/binlog.index |
| log_bin_trust_function_creators         | OFF                                 |
| log_bin_use_v1_row_events               | OFF                                 |
| log_error                               | /u01/my3306/log/alert.log           |
| log_output                              | FILE                                |
| log_queries_not_using_indexes           | ON                                  |
| log_slave_updates                       | ON                                  |
| log_slow_admin_statements               | ON                                  |
| log_slow_slave_statements               | OFF                                 |
| log_throttle_queries_not_using_indexes  | 0                                   |
| log_warnings                            | 1                                   |
| max_binlog_cache_size                   | 2147483648                          |
| max_binlog_size                         | 524288000                           |
| max_binlog_stmt_cache_size              | 18446744073709547520                |
| max_relay_log_size                      | 0                                   |
| relay_log                               | /u01/my3306/log/relaylog            |
| relay_log_basename                      | /u01/my3306/log/relaylog            |
| relay_log_index                         | /u01/my3306/log/relay.index         |
| relay_log_info_file                     | /u01/my3306/log/relay-log.info      |
| relay_log_info_repository               | FILE                                |
| relay_log_purge                         | ON                                  |
| relay_log_recovery                      | OFF                                 |
| relay_log_space_limit                   | 0                                   |
| simplified_binlog_gtid_recovery         | OFF                                 |
| slow_query_log                          | ON                                  |
| slow_query_log_file                     | /u01/my3306/log/slow.log            |
| sql_log_bin                             | ON                                  |
| sql_log_off                             | OFF                                 |
| sync_binlog                             | 100                                 |
| sync_relay_log                          | 10000                               |
| sync_relay_log_info                     | 10000                               |
+-----------------------------------------+-------------------------------------+
61 rows in set (0.02 sec)






***********************************************************************************************************
在安裝過程可能會報錯,一般看日誌
tail -f /u01/my3306/log/alert.log


在執行:mysqld_safe --defaults-file=/u01/my3306/my.cnf --user=mysql &
1、報錯1:
2015-04-02 19:18:00 4201 [Note] RSA private key file not found: /u01/my3306/data//private_key.pem. Some authentication plugins will not work.


解決:
 修改my.cnf中的配置,把下面兩行注釋掉
[mysqld]  
#sha256_password_private_key_path=/u01/my3306/mykey.pem
#sha256_password_public_key_path=/u01/my3306/mykey.pub
 
 2、再執行mysqld_safe --defaults-file=/u01/my3306/my.cnf --user=mysql &
 報錯2:
2015-04-02 19:23:36 6109 [ERROR] Can't find messagefile '/u01/my3306/share/mysql/errmsg.sys'
將源碼包裡面的/bak/share/english/errmsg.sys複製到/u01/my3306/share/mysql/errmsg.sys
scp /bak/share/english/errmsg.sys 192.168.1.18:/u01/my3306/share/mysql/errmsg.sys


搞定!!!!

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.