日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

centos6卸载mysql服务器_CentOS6.5下卸载自带的MySQL数据库安装MySQL5.6

發(fā)布時間:2023/11/27 生活经验 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 centos6卸载mysql服务器_CentOS6.5下卸载自带的MySQL数据库安装MySQL5.6 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

1)查看CentOS自帶的mysql

輸入 rpm -qa | grep mysql

mysql-libs-5.1.71-1.el6.x86_64

2)將其自帶的mysql版本全部卸載(非常重要,如不卸載,后面會產(chǎn)生沖突)

rpm -e --nodeps (mysql版本號,就是上面檢查到的mysql-libs-5.1.71-1.el6.x86_64)

或者用這條命令卸載,yum -y remove mysql-libs*

3)檢查是否將自帶的mysql版本卸載了

rpm -qa | grep mysql

4)創(chuàng)建mysql的存放目錄(我保存在/usr/local/mysql目錄下,可以根據(jù)自己的喜好創(chuàng)建mysql的保存路徑)

mkdir /usr/local/mysql

進入到mysql目錄下

cd /usr/local/mysql

5)上傳mysql到?/usr/local/mysql/ 目錄下

上傳到 /usr/local/mysql/ 目錄后查看

ls

MySQL-5.6.41-1.el6.x86_64.rpm-bundle.tar

6)安裝

先解壓上傳的tar包

tar?-xvf?MySQL-5.6.41-1.el6.x86_64.rpm-bundle.tar

解壓后會得到以下rpm安裝文件:

MySQL-client-5.6.41-1.el6.x86_64.rpm

MySQL-devel-5.6.41-1.el6.x86_64.rpm

MySQL-embedded-5.6.41-1.el6.x86_64.rpm

MySQL-server-5.6.41-1.el6.x86_64.rpm

MySQL-shared-5.6.41-1.el6.x86_64.rpm

MySQL-shared-compat-5.6.41-1.el6.x86_64.rpm

MySQL-test-5.6.41-1.el6.x86_64.rpm

安裝服務(wù)端(注意:服務(wù)端和客戶端都要安裝,否則會出錯)

rpm -ivh MySQL-server-5.6.41-1.el6.x86_64.rpm

出現(xiàn)報錯:

warning: MySQL-server-5.6.41-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

error: Failed dependencies:

libaio.so.1()(64bit) is needed by MySQL-server-5.6.41-1.el6.x86_64

libaio.so.1(LIBAIO_0.1)(64bit) is needed by MySQL-server-5.6.41-1.el6.x86_64

libaio.so.1(LIBAIO_0.4)(64bit) is needed by MySQL-server-5.6.41-1.el6.x86_64

libnuma.so.1()(64bit) is needed by MySQL-server-5.6.41-1.el6.x86_64

libnuma.so.1(libnuma_1.1)(64bit) is needed by MySQL-server-5.6.41-1.el6.x86_64

libnuma.so.1(libnuma_1.2)(64bit) is needed by MySQL-server-5.6.41-1.el6.x86_64

7)安裝所需要的依賴,分別執(zhí)行以下命令

解決缺少perl的依賴:

yum install -y perl

解決缺少libaio.so.1(64bit)的依賴:

這里使用yum install –y libaio.so.1后發(fā)現(xiàn)并不能解決問題,原因yum安裝的并非x86_64版本,而是i686版本

rpm -qa | grep libaio

libaio-0.3.107-10.el6.i686

手動下載libaio-0.3.107-10.el6.x86_64.rpm,下載地址如下:

上傳后安裝

rpm?-ivh?libaio-0.3.107-10.el6.x86_64.rpm

解決缺少libnuma.so.1(64bit)依賴:

yum install -y numactl

再次安裝執(zhí)行:

rpm -ivh MySQL-server-5.6.41-1.el6.x86_64.rpm

。。。省略。。。

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !

You will find that password in '/root/.mysql_secret'.

You must change that password on your first connect,

no other statement but 'SET PASSWORD' will be accepted.

See the manual for the semantics of the 'password expired' flag.

Also, the account for the anonymous user has been removed.

In addition, you can run:

/usr/bin/mysql_secure_installation

which will also give you the option of removing the test database.

This is strongly recommended for production servers.

See the manual for more instructions.

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

The latest information about MySQL is available on the web at

http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

New default config file was created as /usr/my.cnf and

will be used by default by the server when you start it.

You may edit this file to change server settings

安裝過程中提示默認為root用戶設(shè)置了隨機密碼,可以在 /root/.mysql_secret 文件中找到,并且移除了匿名用戶,可以運行 /usr/bin/mysql_secure_installation 命令來移除自帶的測試數(shù)據(jù)庫,還生成了默認配置文件 /usr/my.cnf

8)安裝客戶端

rpm -ivh MySQL-client-5.6.41-1.el6.x86_64.rpm

rpm -ivh MySQL-devel-5.6.41-1.el6.x86_64.rpm

9)檢查是否安裝成功(注意MySQL字母的大小寫)

rpm -qa | grep MySQL

MySQL-server-5.6.41-1.el6.x86_64

MySQL-devel-5.6.41-1.el6.x86_64

MySQL-client-5.6.41-1.el6.x86_64

10)啟動mysql服務(wù)器

service mysql start

出現(xiàn)以下提示說明安裝成功!

Starting MySQL.Logging to '/var/lib/mysql/freeradius.err'.

. SUCCESS!

11)查看默認生成的隨機密碼(最后冒號后面的就是密碼)

cat /root/.mysql_secret

#?The random password set for the root user at Sun Sep 23 07:38:04 2018 (local time): psUGhQBPUZT_LPon

12)登陸mysql(輸入上一步找到的密碼)

mysql -u root -p

13)修改mysql登陸密碼

mysql> set password=password('密碼');

14)啟動mysql

service mysql start

15)將mysql加到系統(tǒng)服務(wù)中并設(shè)置開機啟動

加入到系統(tǒng)服務(wù):chkconfig --add mysql

開機自動啟動:chkconfig mysql on

16)開啟mysql的遠程登錄

默認情況下mysql為安全起見,不支持遠程登錄mysql,所以需要設(shè)置開啟? 遠程登錄mysql的權(quán)限

登錄mysql后輸入如下命令:

mysql -u root -p

mysql> grant all privileges on *.* to 'root' @'%' identified by '密碼';

mysql> flush privileges;

17)開放Linux的對外訪問的端口3306

mysql默認沒有開啟對外訪問端口3306,需要手動開啟

/sbin/iptables

-I INPUT -p tcp --dport 3306 -j ACCEPT

/etc/rc.d/init.d/iptables save? ? ?# 將修改永久保存到防火墻中

18)初始設(shè)置mysql數(shù)據(jù)庫,設(shè)置root密碼,出于安全考慮,可以考慮刪除匿名用戶和測試數(shù)據(jù)庫以及禁用遠程根登錄,參見下面的示例配置。

運行?/usr/bin/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] n

... skipping.

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] n

... skipping.

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

- Dropping test database...

... Success!

- 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

... 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...

19)修改配置文件位置并做相關(guān)設(shè)置

cp /usr/share/mysql/my-default.cnf /etc/my.cnf

vi /etc/my.cnf

# 做如下配置

[client]

port = 3306

default-character-set=utf8

[mysqld]

port = 3306

character_set_server=utf8

character_set_client=utf8

collation-server=utf8_general_ci

log_error = /var/log/mysql/error.log

# 錯誤日志路徑自己定義,前提是目錄必須存在

lower_case_table_names=1

# 注意 linux下mysql安裝完后是默認:表名區(qū)分大小寫,列名不區(qū)分大小寫; 0:區(qū)分大小寫,1:不區(qū)分大小寫

max_connections=1000

# 設(shè)置最大連接數(shù),默認為 151,MySQL服務(wù)器允許的最大連接數(shù)16384

[mysql]

default-character-set = utf8

幾個重要目錄

數(shù)據(jù)庫目錄

/var/lib/mysql/

配置文件

/usr/share/mysql(mysql.server命令及配置文件)

相關(guān)命令

/usr/bin(mysqladmin mysqldump等命令)

啟動腳本

/etc/rc.d/init.d/(啟動腳本文件mysql的目錄)

總結(jié)

以上是生活随笔為你收集整理的centos6卸载mysql服务器_CentOS6.5下卸载自带的MySQL数据库安装MySQL5.6的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。