centos7安裝mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz

http://blog.csdn.net/zhangming1013/article/details/51176242


MySQL-5.6.30-Linux-glibc2.5-x86_64.tar.gz下載地址:

點擊打開鏈接

系統版本:

  1. [mysql@localhost scripts]$ uname -a  
  2. Linux localhost.localdomain 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux  
解壓:

  1. [root@localhost mysql]# tar -zxf mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz -C /usr/local/  
創建mysql用戶:

  1. [root@localhost mysql]# useradd mysql  


設置mysql用戶密碼:
  1. [root@localhost mysql]# echo '123456'|passwd --stdin mysql  
設置權限:
  1. [root@localhost mysql]# cd /usr/local  
  1. [root@localhost local]# chown -R mysql:mysql mysql/  
切換到mysql用戶

  1. [root@localhost local]# su - mysql  
  1. [mysql@localhost ~]$ cd /usr/local/mysql/scripts/  

前置安裝:

yum install -y perl
yum install -y perl-Module-Install.noarch

安裝:

  1. [mysql@localhost scripts]$ ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data  

輸出信息:

  1. [mysql@localhost scripts]$ ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data  
  2. Installing MySQL system tables...2016-04-17 07:41:40 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).  
  3. 2016-04-17 07:41:40 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.30) starting as process 3394 ...  
  4. 2016-04-17 07:41:40 3394 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)  
  5.   
  6. 2016-04-17 07:41:40 3394 [Warning] Buffered warning: Changed limits: table_open_cache: 431 (requested 2000)  
  7.   
  8. 2016-04-17 07:41:40 3394 [Note] InnoDB: Using atomics to ref count buffer pool pages  
  9. 2016-04-17 07:41:40 3394 [Note] InnoDB: The InnoDB memory heap is disabled  
  10. 2016-04-17 07:41:40 3394 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins  
  11. 2016-04-17 07:41:40 3394 [Note] InnoDB: Memory barrier is not used  
  12. 2016-04-17 07:41:40 3394 [Note] InnoDB: Compressed tables use zlib 1.2.3  
  13. 2016-04-17 07:41:40 3394 [Note] InnoDB: Using Linux native AIO  
  14. 2016-04-17 07:41:40 3394 [Note] InnoDB: Using CPU crc32 instructions  
  15. 2016-04-17 07:41:40 3394 [Note] InnoDB: Initializing buffer pool, size = 128.0M  
  16. 2016-04-17 07:41:40 3394 [Note] InnoDB: Completed initialization of buffer pool  
  17. 2016-04-17 07:41:41 3394 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!  
  18. 2016-04-17 07:41:41 3394 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB  
  19. 2016-04-17 07:41:41 3394 [Note] InnoDB: Database physically writes the file full: wait...  
  20. 2016-04-17 07:41:41 3394 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB  
  21. 2016-04-17 07:41:42 3394 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB  
  22. 2016-04-17 07:41:44 3394 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0  
  23. 2016-04-17 07:41:44 3394 [Warning] InnoDB: New log files created, LSN=45781  
  24. 2016-04-17 07:41:44 3394 [Note] InnoDB: Doublewrite buffer not found: creating new  
  25. 2016-04-17 07:41:44 3394 [Note] InnoDB: Doublewrite buffer created  
  26. 2016-04-17 07:41:44 3394 [Note] InnoDB: 128 rollback segment(s) are active.  
  27. 2016-04-17 07:41:44 3394 [Warning] InnoDB: Creating foreign key constraint system tables.  
  28. 2016-04-17 07:41:44 3394 [Note] InnoDB: Foreign key constraint system tables created  
  29. 2016-04-17 07:41:44 3394 [Note] InnoDB: Creating tablespace and datafile system tables.  
  30. 2016-04-17 07:41:44 3394 [Note] InnoDB: Tablespace and datafile system tables created.  
  31. 2016-04-17 07:41:44 3394 [Note] InnoDB: Waiting for purge to start  
  32. 2016-04-17 07:41:44 3394 [Note] InnoDB: 5.6.30 started; log sequence number 0  
  33. 2016-04-17 07:41:45 3394 [Note] Binlog end  
  34. 2016-04-17 07:41:45 3394 [Note] InnoDB: FTS optimize thread exiting.  
  35. 2016-04-17 07:41:45 3394 [Note] InnoDB: Starting shutdown...  
  36. 2016-04-17 07:41:46 3394 [Note] InnoDB: Shutdown completed; log sequence number 1625977  
  37. OK  
  38.   
  39. Filling help tables...2016-04-17 07:41:46 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).  
  40. 2016-04-17 07:41:46 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.30) starting as process 3417 ...  
  41. 2016-04-17 07:41:46 3417 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)  
  42.   
  43. 2016-04-17 07:41:46 3417 [Warning] Buffered warning: Changed limits: table_open_cache: 431 (requested 2000)  
  44.   
  45. 2016-04-17 07:41:46 3417 [Note] InnoDB: Using atomics to ref count buffer pool pages  
  46. 2016-04-17 07:41:46 3417 [Note] InnoDB: The InnoDB memory heap is disabled  
  47. 2016-04-17 07:41:46 3417 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins  
  48. 2016-04-17 07:41:46 3417 [Note] InnoDB: Memory barrier is not used  
  49. 2016-04-17 07:41:46 3417 [Note] InnoDB: Compressed tables use zlib 1.2.3  
  50. 2016-04-17 07:41:46 3417 [Note] InnoDB: Using Linux native AIO  
  51. 2016-04-17 07:41:46 3417 [Note] InnoDB: Using CPU crc32 instructions  
  52. 2016-04-17 07:41:46 3417 [Note] InnoDB: Initializing buffer pool, size = 128.0M  
  53. 2016-04-17 07:41:46 3417 [Note] InnoDB: Completed initialization of buffer pool  
  54. 2016-04-17 07:41:46 3417 [Note] InnoDB: Highest supported file format is Barracuda.  
  55. 2016-04-17 07:41:46 3417 [Note] InnoDB: 128 rollback segment(s) are active.  
  56. 2016-04-17 07:41:46 3417 [Note] InnoDB: Waiting for purge to start  
  57. 2016-04-17 07:41:46 3417 [Note] InnoDB: 5.6.30 started; log sequence number 1625977  
  58. 2016-04-17 07:41:46 3417 [Note] Binlog end  
  59. 2016-04-17 07:41:46 3417 [Note] InnoDB: FTS optimize thread exiting.  
  60. 2016-04-17 07:41:46 3417 [Note] InnoDB: Starting shutdown...  
  61. 2016-04-17 07:41:48 3417 [Note] InnoDB: Shutdown completed; log sequence number 1625987  
  62. OK  
  63.   
  64. To start mysqld at boot time you have to copy  
  65. support-files/mysql.server to the right place for your system  
  66.   
  67. PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !  
  68. To do so, start the server, then issue the following commands:  
  69.   
  70.   /usr/local/mysql/bin/mysqladmin -u root password 'new-password'  
  71.   /usr/local/mysql/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'  
  72.   
  73. Alternatively you can run:  
  74.   
  75.   /usr/local/mysql/bin/mysql_secure_installation  
  76.   
  77. which will also give you the option of removing the test  
  78. databases and anonymous user created by default.  This is  
  79. strongly recommended for production servers.  
  80.   
  81. See the manual for more instructions.  
  82.   
  83. You can start the MySQL daemon with:  
  84.   
  85.   cd . ; /usr/local/mysql/bin/mysqld_safe &  
  86.   
  87. You can test the MySQL daemon with mysql-test-run.pl  
  88.   
  89.   cd mysql-test ; perl mysql-test-run.pl  
  90.   
  91. Please report any problems at http://bugs.mysql.com/  
  92.   
  93. The latest information about MySQL is available on the web at  
  94.   
  95.   http://www.mysql.com  
  96.   
  97. Support MySQL by buying support/licenses at http://shop.mysql.com  
  98.   
  99. New default config file was created as /usr/local/mysql/my.cnf and  
  100. will be used by default by the server when you start it.  
  101. You may edit this file to change server settings  
  102.   
  103. WARNING: Default config file /etc/my.cnf exists on the system  
  104. This file will be read by default by the MySQL server  
  105. If you do not want to use this, either remove it, or use the  
  106. --defaults-file argument to mysqld_safe when starting the server  

這裏可能會報錯:scripts/mysql_install_db: /usr/bin/perl: bad interpreter: No such file or directory。
需要安裝perl以及perl-devel.執行命令:yum –y install perl perl-devel

配置文件

cd /software/mysql-5.6.21/support-files
cp my-default.cnf /etc/my.cnf
cp mysql.server /etc/init.d/mysql
vim /etc/init.d/mysql          #若mysql的安裝目錄是/usr/local/mysql,則可省略此步
修改文件中的兩個變更值
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data

配置環境變量

vi /etc/profile
export MYSQL_HOME=/usr/local/mysql
export PATH=$MYSQL_HOME/bin:$PATH
保存退出
source /etc/profile

啓動

  1. [root@localhost mysql]# chkconfig --add mysql  
  2. [root@localhost mysql]# chkconfig mysql on  
  3. [root@localhost mysql]# service mysql start  
  4. Starting MySQL.. SUCCESS!   
設置root登錄密碼:
  1. /usr/local/mysql/bin/mysqladmin -u root password 'new-password'  
登錄:
  1. [mysql@localhost ~]$ mysql -uroot -p  
  2. Enter password:   
  3. Welcome to the MySQL monitor.  Commands end with ; or \g.  
  4. Your MySQL connection id is 6  
  5. Server version: 5.6.30 MySQL Community Server (GPL)  
  6.   
  7. Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.  
  8.   
  9. Oracle is a registered trademark of Oracle Corporation and/or its  
  10. affiliates. Other names may be trademarks of their respective  
  11. owners.  
  12.   
  13. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.  
  14.   
  15. mysql>   
設置登錄權限:
  1. mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;  
  2. Query OK, 0 rows affected (0.06 sec)  
  3.   
  4. mysql> FLUSH PRIVILEGES;  
  5. Query OK, 0 rows affected (0.04 sec)  
  6.   
  7. mysql>   

客戶端登錄:


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章