linux下用rpm安装mysql
下载地址:http://dev.mysql.com/downloads/mysql/5.1.html,打开网址,找到linux generic项,里面找到5.5.25_x86_64版本下载,需下载两个文件:
MySQL-client-5.5.25a-1.linux2.6.x86_64
MySQL-server-5.5.25a-1.linux2.6.x86_64
1、安装server端:
[root@host127 mysql_5.5.25]# rpm -ivh MySQL-server-5.5.25a-1.linux2.6.x86_64.rpm
Preparing… ########################################### [100%]
ls: cannot access /var/lib/mysql/*.err: No such file or directory
ls: cannot access /var/lib/mysql/*.err: No such file or directory
1:MySQL-server ########################################### [100%]
有以上信息显示为数据库安装成功。
测试是否成功可运行netstat看Mysql端口是否打开,如打开表示服务已经启动,安装成功。Mysql默认的端口是3306。
[root@host127 mysql]# netstat -nat
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:55982 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:5672 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
tcp 0 248 172.21.48.127:22 172.21.35.203:1930 ESTABLISHED
tcp 0 0 172.21.48.127:22 172.21.35.203:2163 ESTABLISHED
tcp 0 0 :::111 :::* LISTEN
tcp 0 0 :::35056 :::* LISTEN
tcp 0 0 :::22 :::* LISTEN
tcp 0 0 ::1:631 :::* LISTEN
tcp 0 0 :::12865 :::* LISTEN
2、安装client端
[root@host127 mysql_5.5.25]# rpm -ivh MySQL-client-5.5.25a-1.linux2.6.x86_64.rpm
Preparing… ########################################### [100%]
package MySQL-client-5.5.25a-1.linux2.6.x86_64 is already installed
有以上信息,也表示数据库client端安装成功。
3、登陆Mysql
用下面的命令连接mysql,测试是否成功。
登陆Mysql的命令是mysql,mysql的初始管理账号是root,没有密码。
[root@host127 mysql_5.5.25]# mysql
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 3
Server version: 5.5.25a MySQL Community Server (GPL)
Copyright (c) 2000, 2011, 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>
抱歉,暂停评论。