1. 程式人生 > >cent os 6.5通過rpm方式安裝mysql5.5

cent os 6.5通過rpm方式安裝mysql5.5

首先在mysql官網下載mysql的rpm安裝包 ,下載地址為:https://dev.mysql.com/downloads/mysql/5.5.html#downloads

可以下載 RPM Bundle版的,這是個壓縮包裡面包含mysql-server、mysql-client、mysql-devel等等所有的rpm包,也可以單獨下載RPM Package, MySQL Server、 RPM Package, Client Utilities、RPM Package, Development Libraries、RPM Package, Compatibility Libraries、RPM Package, Shared components(主要是這5個包,其他可以不用)

上傳這5個rpm包到伺服器,然後依次執行安裝命令  (其中--force --nodeps 是為了強制安裝,忽略本地yum repo )
rpm -ivh MySQL-server-5.5.62-1.el6.x86_64.rpm --force --nodeps
rpm -ivh MySQL-client-5.5.62-1.el6.x86_64.rpm --force --nodeps
rpm -ivh MySQL-devel-5.5.62-1.el6.x86_64.rpm --force --nodeps
rpm -ivh MySQL-shared-compat-5.5.62-1.el6.x86_64.rpm --force --nodeps
rpm -ivh MySQL-shared-5.5.62-1.el6.x86_64.rpm --force --nodeps

[[email protected] data]# rpm -ivh MySQL-server-5.5.62-1.el6.x86_64.rpm --force --nodeps
warning: MySQL-server-5.5.62-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:MySQL-server           ########################################### [100%]
181102 21:18:21 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
181102 21:18:21 [Note] /usr/sbin/mysqld (mysqld 5.5.62) starting as process 1844 ...
181102 21:18:21 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
181102 21:18:21 [Note] /usr/sbin/mysqld (mysqld 5.5.62) starting as process 1851 ...

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h hadoop1 password 'new-password'

Alternatively you can run:
/usr/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.

Please report any problems at http://bugs.mysql.com/

[
[email protected]
data]# rpm -ivh MySQL-client-5.5.62-1.el6.x86_64.rpm --force --nodeps warning: MySQL-client-5.5.62-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:MySQL-client ########################################### [100%] [[email protected] data]# rpm -ivh MySQL-devel-5.5.62-1.el6.x86_64.rpm --force --nodeps warning: MySQL-devel-5.5.62-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:MySQL-devel ########################################### [100%] [[email protected] data]# rpm -ivh MySQL-shared-5.5.62-1.el6.x86_64.rpm --force --nodeps warning: MySQL-shared-5.5.62-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:MySQL-shared ########################################### [100%] [[email protected] data]# rpm -ivh MySQL-shared-compat-5.5.62-1.el6.x86_64.rpm --force --nodeps warning: MySQL-shared-compat-5.5.62-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:MySQL-shared-compat ########################################### [100%]


啟動mysql服務

[[email protected] data]# service mysql start
Starting MySQL.Logging to '/var/lib/mysql/hadoop1.err'.
.                                                          [  OK  ]

將mysql新增到系統服務,開機啟動

[[email protected] data]# chkconfig mysql on

啟動mysqladmin工具建立root使用者,密碼為123456

[[email protected] data]# /usr/bin/mysqladmin -u root password '123456'

此時可以用root使用者登入mysql了

[[email protected] data]# mysql -uroot -p123456
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.62 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, 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> 

mysql需要支援遠端訪問請檢視我的另一篇部落格: 開啟MySQL遠端訪問許可權允許遠端連線(解決Host is not allowed to connect to this MySQL server問題)