日期:2014-05-16  浏览次数:20622 次

linux系统下安装mysql

一.下载安装装包

1.MySQL-client-5.6.5_m8-1.linux2.6.i386.rpm

2.MySQL-server-5.6.5_m8-1.linux2.6.i386.rpm

二.开始安装

1)安装服务器端
在有两个rmp文件的目录下运行如下命令:
[root@localhost mysql]# rpm -ivh MySQL-server-5.6.5_m8-1.linux2.6.i386.rpm
显示如下信息。
warning: MySQL-server-5.6.5_m8-1.linux2.6.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
。。。。。。(省略显示)
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h test1 password 'new-password'
。。。。。。(省略显示)
Starting mysqld daemon with databases from /var/lib/mysql
如出现如上信息,服务端安装完毕。测试是否成功可运行netstatMysql端口是否打开,如打开表示服务已经启动,安装成功。Mysql默认的端口是3306

启动mysql

[root@localhost mysql]# /etc/init.d/mysql start

查看3306端口是否开启

[root@localhost mysql]# netstat -nat

2)安装客户端
运行如下命令:
[root@test1 local]# rpm -ivh MySQL-client-5.6.5_m8-1.linux2.6.i386.rpm
warning:MySQL-client-5.6.5_m8-1.linux2.6.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5
Preparing... ########################################### [100%]
1:MySQL-client ########################################### [100%]
显示安装完毕。

三.登录mysql

[root@localhost mysql]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.16-standard
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
出现了“mysql>”提示符,恭喜你,安装成功!