centos6.4 rpm mysql安裝步驟

來源:互聯網
上載者:User

標籤:

1,檢查MySQL及相關RPM包,是否安裝,如果有安裝,則移除(rpm –e 名稱)  

  

[[email protected] ~]# rpm -qa | grep -i mysql mysql-libs-5.1.66-2.el6_3.x86_64 [[email protected] ~]# yum -y remove mysql-libs*

2,刪除掉系統中原有的資料,不然可以導致錯誤,我實際安裝過程中試了幾個小時,如果還有錯,請參考

點擊開啟連結

mv /var/lib/mysql /var/lib/mysql_old

[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).[Note] Plugin ‘FEDERATED‘ is disabled.[Note] InnoDB: The InnoDB memory heap is disabled[Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins[Note] InnoDB: Compressed tables use zlib 1.2.3[Note] InnoDB: CPU does not support crc32 instructions[Note] InnoDB: Using Linux native AIO[Note] InnoDB: Initializing buffer pool, size = 128.0M[Note] InnoDB: Completed initialization of buffer pool[ERROR] InnoDB: auto-extending data file ./ibdata1 is of a different size 640 pages (rounded down to MB) than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages![ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data![ERROR] Plugin ‘InnoDB‘ init function returned error.[ERROR] Plugin ‘InnoDB‘ registration as a STORAGE ENGINE failed.[ERROR] Unknown/unsupported storage engine: InnoDB[ERROR] Aborting[Note] Binlog end[Note] Shutting down plugin ‘partition‘[Note] Shutting down plugin ‘BLACKHOLE‘[Note] Shutting down plugin ‘PERFORMANCE_SCHEMA‘[Note] Shutting down plugin ‘ARCHIVE‘[Note] Shutting down plugin ‘INNODB_SYS_DATAFILES‘[Note] Shutting down plugin ‘INNODB_SYS_TABLESPACES‘[Note] Shutting down plugin ‘INNODB_SYS_FOREIGN_COLS‘[Note] Shutting down plugin ‘INNODB_SYS_FOREIGN‘[Note] Shutting down plugin ‘INNODB_SYS_FIELDS‘[Note] Shutting down plugin ‘INNODB_SYS_COLUMNS‘[Note] Shutting down plugin ‘INNODB_SYS_INDEXES‘[Note] Shutting down plugin ‘INNODB_SYS_TABLESTATS‘[Note] Shutting down plugin ‘INNODB_SYS_TABLES‘[Note] Shutting down plugin ‘INNODB_FT_INDEX_TABLE‘[Note] Shutting down plugin ‘INNODB_FT_INDEX_CACHE‘[Note] Shutting down plugin ‘INNODB_FT_CONFIG‘[Note] Shutting down plugin ‘INNODB_FT_BEING_DELETED‘[Note] Shutting down plugin ‘INNODB_FT_DELETED‘[Note] Shutting down plugin ‘INNODB_FT_INSERTED‘[Note] Shutting down plugin ‘INNODB_FT_DEFAULT_STOPWORD‘[Note] Shutting down plugin ‘INNODB_METRICS‘[Note] Shutting down plugin ‘INNODB_BUFFER_POOL_STATS‘[Note] Shutting down plugin ‘INNODB_BUFFER_PAGE_LRU‘[Note] Shutting down plugin ‘INNODB_BUFFER_PAGE‘[Note] Shutting down plugin ‘INNODB_CMP_PER_INDEX_RESET‘[Note] Shutting down plugin ‘INNODB_CMP_PER_INDEX‘[Note] Shutting down plugin ‘INNODB_CMPMEM_RESET‘[Note] Shutting down plugin ‘INNODB_CMPMEM‘[Note] Shutting down plugin ‘INNODB_CMP_RESET‘[Note] Shutting down plugin ‘INNODB_CMP‘[Note] Shutting down plugin ‘INNODB_LOCK_WAITS‘[Note] Shutting down plugin ‘INNODB_LOCKS‘[Note] Shutting down plugin ‘INNODB_TRX‘[Note] Shutting down plugin ‘MRG_MYISAM‘[Note] Shutting down plugin ‘MEMORY‘[Note] Shutting down plugin ‘CSV‘[Note] Shutting down plugin ‘MyISAM‘[Note] Shutting down plugin ‘sha256_password‘[Note] Shutting down plugin ‘mysql_old_password‘[Note] Shutting down plugin ‘mysql_native_password‘[Note] Shutting down plugin ‘binlog‘[Note] /usr/sbin/mysqld: Shutdown complete mysqld_safe mysqld from pid file /var/lib/mysql/mysql.pid ended


2,下載Linux對應的RPM包,如:CentOS6.4_32對應的RPM包,如下:

-rwxr--r--. 1 nobody nobody  22838580 Mar 17 17:39 MySQL-client-5.6.17-1.linux_glibc2.5.i386.rpm-rwxr--r--. 1 nobody nobody   4135464 Mar 17 17:40 MySQL-devel-5.6.17-1.linux_glibc2.5.i386.rpm-rwxr--r--. 1 nobody nobody 109826437 Mar 17 17:40 MySQL-embedded-5.6.17-1.linux_glibc2.5.i386.rpm-rwxr--r--. 1 nobody nobody  87469456 Mar 17 17:41 MySQL-server-5.6.17-1.linux_glibc2.5.i386.rpm-rwxr--r--. 1 nobody nobody   2362688 Mar 17 17:41 MySQL-shared-5.6.17-1.linux_glibc2.5.i386.rpm-rwxr--r--. 1 nobody nobody   5294221 Mar 17 17:41 MySQL-shared-compat-5.6.17-1.linux_glibc2.5.i386.rpm-rwxr--r--. 1 nobody nobody  74163863 Mar 17 17:41 MySQL-test-5.6.17-1.linux_glibc2.5.i386.rpm


3, 安裝mysl

[[email protected] rpm]# rpm -ivh MySQL-server-5.6.15-1.el6.x86_64.rpm[[email protected] rpm]# rpm -ivh MySQL-devel-5.6.15-1.el6.x86_64.rpm[[email protected] rpm]# rpm -ivh MySQL-client-5.6.15-1.el6.x86_64.rpm#修改設定檔位置[[email protected] rpm]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf

4,初使化MYSQL及配置密碼

[[email protected] rpm]# /usr/bin/mysql_install_db[[email protected] rpm]# service mysql start[[email protected] rpm]# cat /root/.mysql_secret  #查看root帳號密碼# The random password set for the root user at Wed Dec 11 23:32:50 2013 (local time): qKTaFZnl[[email protected] ~]# mysql -uroot –pqKTaFZnlmysql> SET PASSWORD = PASSWORD(‘123456‘);    #設定密碼為123456mysql> exit[[email protected] ~]# mysql -uroot -p123456


5,允許遠程登入

mysql> use mysql;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql> select host,user,password from user;+-----------------------+------+-------------------------------------------+| host                  | user | password                                  |+-----------------------+------+-------------------------------------------+| localhost             | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B || localhost.localdomain | root | *A4B8196FF869F64E0119B231785E5946EDBA5E26 || 127.0.0.1             | root | *A4B8196FF869F64E0119B231785E5946EDBA5E26 || ::1                   | root | *A4B8196FF869F64E0119B231785E5946EDBA5E26 |+-----------------------+------+-------------------------------------------+4 rows in set (0.00 sec)mysql> update user set password=password(‘root‘) where user=‘root‘;Query OK, 3 rows affected (0.01 sec)Rows matched: 4  Changed: 3  Warnings: 0mysql> update user set host=‘%‘ where user=‘root‘ and host=‘localhost‘;Query OK, 1 row affected (0.04 sec)Rows matched: 1  Changed: 1  Warnings: 0mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)


6,設定開機自啟動

[[email protected] ~]# chkconfig mysql on[[email protected] ~]# chkconfig --list | grep mysqlmysql           0:off   1:off   2:on    3:on    4:on    5:on    6:off

7,查看mysql設定檔位置

mysqld --verbose --help | grep -A 1 ‘Default options‘


8,MYSQL預設安裝位置

/var/lib/mysql/               #資料庫目錄/usr/share/mysql              #設定檔目錄/usr/bin                     #相關命令目錄/etc/init.d/mysql              #啟動指令碼


9,配置字元集

修改字元集和資料存放區路徑

配置/etc/my.cnf檔案,修改資料存放路徑、mysql.sock路徑以及預設編碼utf-8.

[client]      password        = 123456      port            = 3306      default-character-set=utf8      [mysqld]      port            = 3306      character_set_server=utf8      character_set_client=utf8      collation-server=utf8_general_ci      #(注意linux下mysql安裝完後是預設:表名區分大小寫,列名不區分大小寫; 0:區分大小寫,1:不區分大小寫)      lower_case_table_names=1      #(設定最大串連數,預設為 151,MySQL伺服器允許的最大串連數16384; )      max_connections=1000      [mysql]      default-character-set = utf8

查看字元集

show variables like ‘%collation%‘;

show variables like ‘%char%‘;

centos6.4 rpm mysql安裝步驟

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.