您的位置:首页 > 运维架构 > Linux

在linux上安装mysql rpm包

2015-12-18 17:51 603 查看
环境:

linux:CentOS release 6.3

mysql: 5.6.28-log MySQL Community Server (GPL)

1.检查mysql rpm相关的包是否安装

[root@mysqlmaster mysqlinstall]# rpm -qa | grep -i mysql

mysql-libs-5.1.61-4.el6.x86_64

如果存在删除:

[root@mysqlmaster mysqlinstall]# rpm -e mysql-libs-5.1.61-4.el6.x86_64

error: Failed dependencies:

libmysqlclient.so.16()(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64

libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64

mysql-libs is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64

忽略依赖包删除

[root@redis1 ~]# rpm -e --nodeps mysql-libs-5.1.61-4.el6.x86_64

或者删除依赖包

[root@mysqlmaster mysqlinstall]# yum -y remove mysql-libs

[root@mysqlmaster mysqlinstall]# rpm -qa | grep -i mysql

2.上传下载的安装包MySQL-5.6.28-1.el6.x86_64.rpm-bundle.tar

解压:

tar -xvf MySQL-5.6.28-1.el6.x86_64.rpm-bundle.tar

3.安装mysql服务端:

[root@mysqlmaster mysqlinstall]# rpm -ivh MySQL-server-5.6.28-1.el6.x86_64.rpm

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

error: Failed dependencies:

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

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

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

缺失依赖包

[root@mysqlmaster mysqlinstall]# yum install numactl

[root@mysqlmaster mysqlinstall]# rpm -ivh MySQL-server-5.6.28-1.el6.x86_64.rpm

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

Preparing... ########################################### [100%]

1:MySQL-server ########################################### [100%]

warning: user mysql does not exist - using root

warning: group mysql does not exist - using root

4.安装mysql 客户端

[root@mysqlmaster mysqlinstall]# rpm -ivh MySQL-client-5.6.28-1.el6.x86_64.rpm

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

Preparing... ########################################### [100%]

1:MySQL-client ########################################### [100%]

[root@mysqlmaster mysqlinstall]#

5.修改mysql配置文件

vi /etc/my.cnf

[mysqld]

# Options for mysqld process:

#skip-grant-tables

character_set_server=utf8

lower_case_table_names=1

max_connections=1000

datadir=/var/lib/mysql

[root@mysqlmaster mysql]# service mysql start

Starting MySQL SUCCESS!

6.登录修改root密码

查看root 用户的密码

[root@mysqlmaster mysql]# cat /root/.mysql_secret

# The random password set for the root user at Fri Dec 18 14:12:44 2015 (local time): g478da9wvEZniGqa

root用户登录

[root@mysqlmaster mysql]# mysql -uroot -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.6.28

Copyright (c) 2000, 2015, 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> SET PASSWORD = PASSWORD('root001'); ---设置root用户密码

Query OK, 0 rows affected (0.01 sec)

mysql> exit

Bye

重新登录

[root@mysqlmaster mysql]# mysql -uroot -proot001

7.设置root用户支持远程登录:

mysql> select host,user,password from user;

+-------------+------+-------------------------------------------+

| host | user | password |

+-------------+------+-------------------------------------------+

| localhost | root | *F4368ED34678C82DC260E668501F2FA7201F34EB |

| mysqlmaster | root | *F7FFE6B0AA46DE21A8F0520CE00A0927B01B125D |

| 127.0.0.1 | root | *F7FFE6B0AA46DE21A8F0520CE00A0927B01B125D |

| ::1 | root | *F7FFE6B0AA46DE21A8F0520CE00A0927B01B125D |

+-------------+------+-------------------------------------------+

4 rows in set (0.00 sec)

mysql> update user set password=password('root001') where user='root';

Query OK, 3 rows affected (0.00 sec)

Rows matched: 4 Changed: 3 Warnings: 0

mysql> update user set host='%' where user='root' and host='localhost';

Query OK, 1 row affected (0.00 sec)

Rows matched: 1 Changed: 1 Warnings: 0

mysql> select host,user,password from user;

+-------------+------+-------------------------------------------+

| host | user | password |

+-------------+------+-------------------------------------------+

| % | root | *F4368ED34678C82DC260E668501F2FA7201F34EB |

| mysqlmaster | root | *F4368ED34678C82DC260E668501F2FA7201F34EB |

| 127.0.0.1 | root | *F4368ED34678C82DC260E668501F2FA7201F34EB |

| ::1 | root | *F4368ED34678C82DC260E668501F2FA7201F34EB |

+-------------+------+-------------------------------------------+

4 rows in set (0.00 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: