您好,欢迎访问一九零五行业门户网

mysql数据库在Linux操作系统上的安装及容易出现的问题_MySQL

bitscn.com
一、测试环境如下:
    1、vmwareworkstation:6.0.2 build-59824
    2、mysql 数据库的版本:
      服务器端:mysql-server-5.5.19-1.linux2.6.i386.rpm
      客 户 端:mysql-client-5.5.19-1.linux2.6.i386.rpm
              3、需要的插件包:libaio-0.3.105-2.i386.rpm
    4、linux版本:redhat linux as 4
二、执行安装
    1、[root@ssbsc mysql]# rpm -ivh libaio-0.3.105-2.i386.rpm
    2、[root@ssbsc mysql]# rpm -ivh mysql-server-5.5.19-1.linux2.6.i386.rpm
    3、[root@ssbsc mysql]# rpm -ivh mysql-client-5.5.19-1.linux2.6.i386.rpm
三、验证
   使用netstat -nat 命令进行验证,看mysql数据库是否已经启动。
   [root@ssbsc mysql]# netstat -nat
   active internet connections (servers and established)
   proto recv-q send-q local address               foreign address             state       
   tcp        0      0 :::3306                     :::*                        listen
   观察到local address的3306端口已经开启,说明服务已经启动,如果没有启动可以使用如下命令进行开启:
    [root@ssbsc mysql]# service mysql start
   starting mysql..                                           [  ok  ]
四、登录mysql
          登录mysql的命令是mysql,mysql 的使用语法如下:
 mysql [-u username] [-h host] [-p[password]] [dbname]
 username 与password 分别是mysql 的用户名与密码,mysql的初始管理帐号是root,没有密码。在这里我 设置了密码,所以采用有密码的方式进行登录。
     [root@ssbsc mysql]# mysql -u root -p
     enter password:
     welcome to the mysql monitor.  commands end with ; or /g.
     your mysql connection id is 2
     server version: 5.5.19 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>
如果出现了如上所示的mysql>,则证明你已经成功登录了。
五、在windows 操作系统上利用navicat for mysql登录linux系统上刚才安装的mysql数据库
通常情况下会遇到的问题:
error1: 2003:can't connect to mysql server on 'localhost'
解决方法:关闭linux的防火墙功能,或者设置容许tcp协议的3306端口通过,可以下使用如下命令开启tcp协议的3306端口
[root@bugzilla ~]# more /etc/sysconfig/iptables
-a rh-firewall-1-input -p tcp --dport 3306 -j accept
error2: 1130 - host'clientip' is not allowed to connect to this mysql server
解决方法:使用root 用户登陆linux,登陆mysql的root用户,更改容许登陆的ip地址范围。
[root@bugzilla ~]# mysql -u root -p
mysql>grant all privileges on *.* to 'root'@'%' identified by 'your password' with grant option;
这段指令容许所有用root用户输入密码登陆该mysql server,如果将'%' 换成'192.168.1.208' ,那么只有'192.168.1.208'的主机可以登陆。
摘自 寒雪痕的专栏
bitscn.com
其它类似信息

推荐信息