最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

在阿里云的CentOS環(huán)境中安裝配置MySQL的教程

 更新時(shí)間:2015年12月16日 11:21:03   作者:fengyqf  
這篇文章主要介紹了在阿里云的CentOS環(huán)境中安裝配置MySQL的教程,注意一下文章開頭所提到的系統(tǒng)自帶MariaDB的問題,需要的朋友可以參考下

1 常規(guī)錯(cuò)誤的yum安裝方法:

在前文中記述了CentOS 6.5系統(tǒng)中通過yum方式快速地搭建了LNMP環(huán)境,那么是否也能在CentOS 7或CentOS 7.1系統(tǒng)中依葫蘆畫瓢安裝MySql5.6.24呢?答案是否定的。

[root@typecodes ~]# yum -y install mysql mysql-server mysql-devel
.....................。
....省略部分安裝過程....
.....................。

Installed:
 mariadb.x86_64 1:5.5.41-2.el7_0             mariadb-devel.x86_64 1:5.5.41-2.el7_0            

Dependency Installed:
 keyutils-libs-devel.x86_64 0:1.5.8-3.el7 krb5-devel.x86_64 0:1.12.2-14.el7  libcom_err-devel.x86_64 0:1.42.9-7.el7 libselinux-devel.x86_64 0:2.2.2-6.el7 
 libsepol-devel.x86_64 0:2.1.9-3.el7   libverto-devel.x86_64 0:0.2.5-4.el7 openssl-devel.x86_64 1:1.0.1e-42.el7.4 pcre-devel.x86_64 0:8.32-14.el7   
 zlib-devel.x86_64 0:1.2.7-13.el7   

Complete!

從上面的安裝結(jié)果可以看出,沒有安裝mysql數(shù)據(jù)庫,而是安裝了mariadb數(shù)據(jù)!因?yàn)樵贑entOS 7和CentOS 7.1系統(tǒng)中,默認(rèn)安裝的mysql是它的分支mariadb。這里引用下百度百科關(guān)于mariadb的描述:

MariaDB數(shù)據(jù)庫管理系統(tǒng)是MySQL的一個(gè)分支,主要由開源社區(qū)在維護(hù),采用GPL授權(quán)許可 MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能輕松成為MySQL的代替品。
因此,下面這些正常的MySQL操作都是無效的:

#######無法把mysql服務(wù)加入系統(tǒng)啟動
[root@typecodes ~]# chkconfig mysqld on
error reading information on service mysqld: No such file or directory
#######啟動不了mysql
[root@typecodes ~]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
Failed to issue method call: Unit mysqld.service failed to load: No such file or directory.
#######沒有安裝mysql相關(guān)包
[root@typecodes ~]# rpm -qa |grep mysql
php-mysql-5.4.16-23.el7_0.3.x86_64
[root@typecodes ~]#

2 正確的安裝方法:

眾所周知,Linux系統(tǒng)自帶的repo是不會自動更新每個(gè)軟件的最新版本(基本都是比較靠后的穩(wěn)定版),所以無法通過yum方式安裝MySQL的高級版本。所以我們需要先安裝帶有當(dāng)前可用的mysql5系列社區(qū)版資源的rpm包。

#######安裝rpm包
[root@typecodes ~]# rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Retrieving http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Preparing...       ################################# [100%]
Updating / installing...
 1:mysql-community-release-el7-5 ################################# [100%]

這時(shí)查看當(dāng)前可用的mysql安裝資源:

[root@typecodes ~]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64 MySQL Connectors Community     14
mysql-tools-community/x86_64  MySQL Tools Community      17
mysql56-community/x86_64   MySQL 5.6 Community Server    139

從上面的列表可以看出, mysql56-community/x86_64 和 MySQL 5.6 Community Server 可以使用。

因此,我們就可以直接用yum方式安裝了MySQL5.6版本了。

[root@typecodes ~]# yum -y install mysql-community-server
Loaded plugins: axelget, langpacks
No metadata available for base
No metadata available for epel
No metadata available for extras
(Failed to load module fastestmirror: No module named fastestmirror)
repomd.xml                                  | 2.5 kB 00:00:00  
update mysql-connectors-community metadata successfully
(Failed to load module fastestmirror: No module named fastestmirror)
repomd.xml                                  | 2.5 kB 00:00:00  
update mysql-tools-community metadata successfully
(Failed to load module fastestmirror: No module named fastestmirror)
repomd.xml                                  | 2.5 kB 00:00:00  
update mysql56-community metadata successfully
No metadata available for updates
mysql-connectors-community                              | 2.5 kB 00:00:00  
mysql-tools-community                               | 2.5 kB 00:00:00  
mysql56-community                                | 2.5 kB 00:00:00  
(1/3): mysql-connectors-community/x86_64/primary_db                        | 7.3 kB 00:00:00  
(2/3): mysql56-community/x86_64/primary_db                          | 83 kB 00:00:01  
mysql-tools-community/x86_64/p FAILED           ==============================================  ] 19 kB/s | 92 kB 00:00:00 ETA 
http://repo.mysql.com/yum/mysql-tools-community/el/7/x86_64/repodata/3301d2eb425f300dec5a46c4201d08f2cf9232a6-primary.sqlite.bz2: [Errno 12] Timeout on http://repo.mysql.com/yum/mysql-tools-community/el/7/x86_64/repodata/3301d2eb425f300dec5a46c4201d08f2cf9232a6-primary.sqlite.bz2: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 3 seconds')
Trying other mirror.
(3/3): mysql-tools-community/x86_64/primary_db                         | 15 kB 00:00:00  
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.6.24-3.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.6.24-3.el7 for package: mysql-community-server-5.6.24-3.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) = 5.6.24-3.el7 for package: mysql-community-server-5.6.24-3.el7.x86_64
--> Processing Dependency: perl(DBI) for package: mysql-community-server-5.6.24-3.el7.x86_64
--> Running transaction check
---> Package mariadb.x86_64 1:5.5.41-2.el7_0 will be obsoleted
---> Package mysql-community-client.x86_64 0:5.6.24-3.el7 will be obsoleting
--> Processing Dependency: mysql-community-libs(x86-64) = 5.6.24-3.el7 for package: mysql-community-client-5.6.24-3.el7.x86_64
---> Package mysql-community-common.x86_64 0:5.6.24-3.el7 will be installed
---> Package perl-DBI.x86_64 0:1.627-4.el7 will be installed
--> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-4.el7.x86_64
--> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-4.el7.x86_64
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.41-2.el7_0 will be obsoleted
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.41-2.el7_0 for package: 1:mariadb-devel-5.5.41-2.el7_0.x86_64
---> Package mysql-community-libs.x86_64 0:5.6.24-3.el7 will be obsoleting
---> Package perl-PlRPC.noarch 0:0.2020-14.el7 will be installed
--> Processing Dependency: perl(Net::Daemon) >= 0.13 for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Test) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Log) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Compress::Zlib) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Running transaction check
---> Package mariadb-devel.x86_64 1:5.5.41-2.el7_0 will be obsoleted
---> Package mysql-community-devel.x86_64 0:5.6.24-3.el7 will be obsoleting
---> Package perl-IO-Compress.noarch 0:2.061-2.el7 will be installed
--> Processing Dependency: perl(Compress::Raw::Zlib) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
--> Processing Dependency: perl(Compress::Raw::Bzip2) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
---> Package perl-Net-Daemon.noarch 0:0.48-5.el7 will be installed
--> Running transaction check
---> Package perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 will be installed
---> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================================================================================
 Package           Arch       Version        Repository         Size
=======================================================================================================================================================================
Installing:
 mysql-community-client       x86_64       5.6.24-3.el7       mysql56-community       19 M
  replacing mariadb.x86_64 1:5.5.41-2.el7_0
 mysql-community-devel       x86_64       5.6.24-3.el7       mysql56-community       3.4 M
  replacing mariadb-devel.x86_64 1:5.5.41-2.el7_0
 mysql-community-libs       x86_64       5.6.24-3.el7       mysql56-community       2.0 M
  replacing mariadb-libs.x86_64 1:5.5.41-2.el7_0
 mysql-community-server       x86_64       5.6.24-3.el7       mysql56-community       58 M
Installing for dependencies:
 mysql-community-common       x86_64       5.6.24-3.el7       mysql56-community       256 k
 perl-Compress-Raw-Bzip2       x86_64       2.061-3.el7       base          32 k
 perl-Compress-Raw-Zlib       x86_64       1:2.061-4.el7       base          57 k
 perl-DBI          x86_64       1.627-4.el7       base          802 k
 perl-IO-Compress        noarch       2.061-2.el7       base          260 k
 perl-Net-Daemon         noarch       0.48-5.el7        base          51 k
 perl-PlRPC          noarch       0.2020-14.el7       base          36 k

Transaction Summary
=======================================================================================================================================================================
Install 4 Packages (+7 Dependent packages)

Total download size: 83 M
Downloading packages:
mysql-community-devel-5.6.24-3.el7.x86_64.rpm                         | 3.4 MB 00:00:03  
mysql-community-client-5.6.24-3.el7.x86_64.rpm                         | 19 MB 00:00:05  
mysql-community-server-5.6.24-3.el7.x86_64.rpm                         | 58 MB 00:00:11  
mysql-community-libs-5.6.24-3.el7.x86_64.rpm                         | 2.0 MB 00:00:02  
perl-DBI-1.627-4.el7.x86_64.rpm                             | 0 B 00:00:01 ... 
perl-DBI-1.627-4.el7.x86_64.rpm                             | 802 kB 00:00:00  
(1/6): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm                       | 57 kB 00:00:00  
(2/6): perl-Net-Daemon-0.48-5.el7.noarch.rpm                         | 51 kB 00:00:00  
(3/6): perl-PlRPC-0.2020-14.el7.noarch.rpm                          | 36 kB 00:00:00  
(4/6): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm                       | 32 kB 00:00:00  
(5/6): perl-IO-Compress-2.061-2.el7.noarch.rpm                         | 260 kB 00:00:00  
warning: /var/cache/yum/x86_64/7/mysql56-community/packages/mysql-community-common-5.6.24-3.el7.x86_64.rpm: V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY 00:00:01 ETA 
Public key for mysql-community-common-5.6.24-3.el7.x86_64.rpm is not installed
(6/6): mysql-community-common-5.6.24-3.el7.x86_64.rpm                       | 256 kB 00:00:01  
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                 388 kB/s | 692 kB 00:00:01  
Retrieving key from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
 Userid  : "MySQL Release Engineering <mysql-build@oss.oracle.com>"
 Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
 Package : mysql-community-release-el7-5.noarch (installed)
 From  : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
 Installing : mysql-community-common-5.6.24-3.el7.x86_64                           1/14 
 Installing : mysql-community-libs-5.6.24-3.el7.x86_64                           2/14 
 Installing : mysql-community-client-5.6.24-3.el7.x86_64                           3/14 
 Installing : perl-Net-Daemon-0.48-5.el7.noarch                             4/14 
 Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64                          5/14 
 Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64                           6/14 
 Installing : perl-IO-Compress-2.061-2.el7.noarch                            7/14 
 Installing : perl-PlRPC-0.2020-14.el7.noarch                             8/14 
 Installing : perl-DBI-1.627-4.el7.x86_64                              9/14 
 Installing : mysql-community-server-5.6.24-3.el7.x86_64                          10/14 
 Installing : mysql-community-devel-5.6.24-3.el7.x86_64                           11/14 
 Erasing : 1:mariadb-devel-5.5.41-2.el7_0.x86_64                            12/14 
 Erasing : 1:mariadb-5.5.41-2.el7_0.x86_64                             13/14 
 Erasing : 1:mariadb-libs-5.5.41-2.el7_0.x86_64                            14/14 
 Verifying : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64                           1/14 
 Verifying : mysql-community-common-5.6.24-3.el7.x86_64                           2/14 
 Verifying : mysql-community-devel-5.6.24-3.el7.x86_64                           3/14 
 Verifying : mysql-community-client-5.6.24-3.el7.x86_64                           4/14 
 Verifying : perl-PlRPC-0.2020-14.el7.noarch                             5/14 
 Verifying : mysql-community-server-5.6.24-3.el7.x86_64                           6/14 
 Verifying : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64                          7/14 
 Verifying : mysql-community-libs-5.6.24-3.el7.x86_64                           8/14 
 Verifying : perl-Net-Daemon-0.48-5.el7.noarch                             9/14 
 Verifying : perl-DBI-1.627-4.el7.x86_64                              10/14 
 Verifying : perl-IO-Compress-2.061-2.el7.noarch                            11/14 
 Verifying : 1:mariadb-5.5.41-2.el7_0.x86_64                             12/14 
 Verifying : 1:mariadb-devel-5.5.41-2.el7_0.x86_64                            13/14 
 Verifying : 1:mariadb-libs-5.5.41-2.el7_0.x86_64                            14/14 

Installed:
 mysql-community-client.x86_64 0:5.6.24-3.el7   mysql-community-devel.x86_64 0:5.6.24-3.el7   mysql-community-libs.x86_64 0:5.6.24-3.el7   
 mysql-community-server.x86_64 0:5.6.24-3.el7   

Dependency Installed:
 mysql-community-common.x86_64 0:5.6.24-3.el7 perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 perl-DBI.x86_64 0:1.627-4.el7
 perl-IO-Compress.noarch 0:2.061-2.el7  perl-Net-Daemon.noarch 0:0.48-5.el7   perl-PlRPC.noarch 0:0.2020-14.el7   

Replaced:
 mariadb.x86_64 1:5.5.41-2.el7_0     mariadb-devel.x86_64 1:5.5.41-2.el7_0     mariadb-libs.x86_64 1:5.5.41-2.el7_0     

Complete!

3 MySQL安裝完成后,進(jìn)行相關(guān)配置

安裝完MySQL后,需要進(jìn)行一些基礎(chǔ)配置工作:

#######安裝成功后,將其加入開機(jī)啟動
[root@typecodes ~]# systemctl enable mysqld

#######啟動mysql服務(wù)進(jìn)程
[root@typecodes ~]# systemctl start mysqld

#######配置mysql(設(shè)置密碼等)
[root@typecodes ~]# 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.

Set root password? [Y/n] y     [設(shè)置root用戶密碼]
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


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] y     [刪除匿名用戶]
 ... Success!

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  [禁止root遠(yuǎn)程登錄]
 ... 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   [刪除test數(shù)據(jù)庫]
 - Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
 ... Failed! Not critical, keep moving...
 - 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   [刷新權(quán)限]
 ... 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...

4.可能有效的MySQL配置優(yōu)化
在原始配置文件  /etc/my.cnf 基礎(chǔ)上,在 [mysqld] 節(jié)內(nèi)增加配置參數(shù)。實(shí)際應(yīng)用中,請按硬件及負(fù)載酌情修改。

#add by feng 120418 --------------------------
#skip-locking
skip-name-resolve
skip-external-locking
key_buffer_size = 256M
#table_cache = 3072
table_open_cache = 3072
read_buffer_size = 2M
read_rnd_buffer_size = 2M
sort_buffer_size = 2M
myisam_sort_buffer_size = 256M
thread_cache_size = 8
query_cache_size= 512M
query_cache_limit= 5M
tmp_table_size=1024M
max_heap_table_size=3000M
max_allowed_packet = 16M
innodb_buffer_pool_size = 512M
innodb_log_file_size = 512M
innodb_additional_mem_pool_size=512M
innodb_log_buffer_size=64M
max_connections=2000
max_user_connections=800
join_buffer_size = 8M
open_files_limit = 65535
#tmpdir=/dev/shm
max_connect_errors=1000
#add by feng 120418 end ---------------------

相關(guān)文章

  • MySQL預(yù)編譯功能詳解

    MySQL預(yù)編譯功能詳解

    這篇文章主要為大家詳細(xì)介紹了MySQL預(yù)編譯功能的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-10-10
  • 深入分析Mysql中l(wèi)imit的用法

    深入分析Mysql中l(wèi)imit的用法

    很久沒用mysql的limit,一時(shí)大意竟然用錯(cuò)了,自認(rèn)為(limit 開始,結(jié)束),其實(shí)錯(cuò)了,正確的應(yīng)該是(limit 偏移量,條數(shù)),為了記住這次錯(cuò)誤,轉(zhuǎn)載一篇limit用法詳解。推薦給大家,希望對大家能夠有所幫助。
    2015-03-03
  • Mysql查看版本號的幾種方式

    Mysql查看版本號的幾種方式

    這篇文章主要介紹了Mysql查看版本號的五種方式介紹,需要的朋友可以參考下
    2013-05-05
  • mysql 5.7.15 安裝配置方法圖文教程

    mysql 5.7.15 安裝配置方法圖文教程

    這篇文章主要為大家分享了mysql 5.7.15安裝配置方法圖文教程,感興趣的朋友可以參考一下
    2016-09-09
  • mysql如何批量修改表名前綴

    mysql如何批量修改表名前綴

    這篇文章主要介紹了mysql如何批量修改表名前綴的實(shí)現(xiàn)方式,具有很好的參考價(jià)值,希望對大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2025-05-05
  • MySQL數(shù)據(jù)庫的備份與還原操作方法

    MySQL數(shù)據(jù)庫的備份與還原操作方法

    這篇文章主要介紹了MySQL數(shù)據(jù)庫的備份與還原操作方法,文章圍繞主題展開詳細(xì)的內(nèi)容加入,具有一定的參考價(jià)值,需要的小伙伴可以參考一下
    2022-06-06
  • 用mysqldump備份和恢復(fù)指定表的方法

    用mysqldump備份和恢復(fù)指定表的方法

    用mysqldump備份和恢復(fù)指定表的方法...
    2007-07-07
  • MySQL 5.5/5.6/5.7及以上版本安裝包安裝時(shí)如何選擇安裝路徑

    MySQL 5.5/5.6/5.7及以上版本安裝包安裝時(shí)如何選擇安裝路徑

    最近mysql官方網(wǎng)站的安裝包從5.5-5.7起都是新版的安裝界面,各種環(huán)境要求支持,看樣子以后老點(diǎn)的系統(tǒng)安裝都夠費(fèi)勁的了,這里腳本之家小編特為大家整理一下安裝步驟與方法
    2016-04-04
  • 詳解MySQL8的新特性ROLE

    詳解MySQL8的新特性ROLE

    這篇文章主要介紹了詳解MySQL8的新特性ROLE的相關(guān)資料,幫助大家更好的理解和使用MySQL8,感興趣的朋友可以了解下
    2020-11-11
  • Mysql遷移DM國產(chǎn)達(dá)夢數(shù)據(jù)庫完整步驟記錄

    Mysql遷移DM國產(chǎn)達(dá)夢數(shù)據(jù)庫完整步驟記錄

    最近工作中用到國產(chǎn)數(shù)據(jù)庫達(dá)夢,簡稱DM,下面這篇文章主要給大家介紹了關(guān)于Mysql遷移DM國產(chǎn)達(dá)夢數(shù)據(jù)庫完整步驟的相關(guān)資料,文中通過圖文介紹的非常詳細(xì),需要的朋友可以參考下
    2024-07-07

最新評論

鹿邑县| 屏东市| 巴林右旗| 同仁县| 桦川县| 公主岭市| 廉江市| 曲阜市| 永济市| 开封县| 阿巴嘎旗| 禄丰县| 徐汇区| 天长市| 迁安市| 将乐县| 屯留县| 普宁市| 翼城县| 鸡泽县| 获嘉县| 珠海市| 永善县| 武威市| 二手房| 会宁县| 富蕴县| 苗栗市| 安仁县| 双江| 台安县| 察隅县| 昭苏县| 永宁县| 泾源县| 土默特右旗| 拉孜县| 淳安县| 辉南县| 大名县| 江津市|