MySQL在linux上的rpm包方式安装方法

时间:2023-03-08 17:25:38
MySQL在linux上的rpm包方式安装方法

1、下载上传mysql server和client rpm包:

[root@faspdev mnt]# ls

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

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

2、安装mysql数据库:

1)安装mysql server端rpm包:

[root@faspdev mnt]# rpm -ivh MySQL-server-5.5.53-1.el6.x86_64.rpm

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

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

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

2)安装mysql client端rpm包:

[root@faspdev mnt]# rpm -ivh MySQL-client-5.5.53-1.el6.x86_64.rpm

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

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

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

3、启动、关闭mysql数据库:

1)命令方式:

*启动数据库:

[root@faspdev bin]# pwd

/usr/bin

[root@faspdev bin]# ./mysqld_safe &

[1] 21688

[root@faspdev bin]# 161018 17:47:08 mysqld_safe Logging to '/var/lib/mysql/faspdev.err'.

161018 17:47:08 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

*关闭数据库:

[root@faspdev bin]# pwd

/usr/bin

[root@faspdev bin]# ./mysqladmin -uroot shutdown

2)服务方式:

*启动数据库:

[root@faspdev ~]# service mysql status

MySQL is not running                                       [FAILED]

[root@faspdev ~]# service mysql start

Starting MySQL..                                           [  OK  ]

[root@faspdev ~]# service mysql status

MySQL running (21992)                                      [  OK  ]

*关闭数据库:

[root@faspdev ~]# service mysql stop

Shutting down MySQL.                                       [  OK  ]

[root@faspdev ~]# service mysql status

MySQL is not running                                       [FAILED]

4、访问数据库:

MySQL在linux上的rpm包方式安装方法