uuhua的个人主页

http://www.qtcn.org/bbs/u/136486  [收藏] [复制]

uuhua

  • 4

    关注

  • 7

    粉丝

  • 20

    访客

  • 等级:新手上路
  • 总积分:16
  • 保密,1985-11-01

最后登录:2018-04-24

更多资料

日志

Mysql在suse下安装过程

2014-12-10 11:39
安装前准备工作:

下载server安装包(rpm包)及客户端安装包:

我用的是官网上提供的最新版:

server:MySQL-server-5.1.53-1.glibc23.i386.rpm

client:MySQL-client-5.1.53-1.glibc23.i386.rpm

两包都考到本地后,进入要安装目录:

我的是mysql这个目录下:

xSwap@linux-p33n:~/mysql>

由于我当前用户没有权限进行安装操作,可以sudo提升权限也可切换用户,我赚麻烦直接换用户了 su root  your password OK

好,现在开始安装server包:

linux-p33n:/home/xSwap/mysql # rpm -ivh MySQL-server-5.1.53-1.glibc23.i386.rpm
Preparing...                ########################################### [100%]
   1:MySQL-server           ########################################### [100%]

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h linux-p33n password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

Please report any problems with the /usr/bin/mysqlbug script!

Starting MySQL.                                                      done

安装完了,成功与否,看下端口就知道:

linux-p33n:/home/xSwap/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:3306            0.0.0.0:*               LISTEN      
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      
tcp        0      0 127.0.0.1:3306          127.0.0.1:48125         TIME_WAIT  
tcp        0      0 127.0.0.1:3306          127.0.0.1:48128         TIME_WAIT  
tcp        0      0 127.0.0.1:3306          127.0.0.1:48123         TIME_WAIT  
tcp        0      0 127.0.0.1:3306          127.0.0.1:48122         TIME_WAIT  
tcp        0      0 127.0.0.1:3306          127.0.0.1:48127         TIME_WAIT  
tcp        0      0 127.0.0.1:3306          127.0.0.1:48130         TIME_WAIT  
tcp        0      0 127.0.0.1:3306          127.0.0.1:48124         TIME_WAIT  
tcp        0      0 127.0.0.1:3306          127.0.0.1:48126         TIME_WAIT  
tcp        0      0 :::11168                :::*                    LISTEN      
tcp        0      0 :::9000                 :::*                    LISTEN      
tcp        0      0 :::111                  :::*                    LISTEN      
tcp        0      0 ::1:631                 :::*                    LISTEN      
tcp        0      0 ::1:25                  :::*                    LISTEN      
tcp        0      0 127.0.0.1:48131         127.0.0.1:3306          TIME_WAIT  
tcp        1      0 192.9.11.210:9000       192.9.11.73:4910        CLOSE_WAIT  
tcp        0      0 192.9.11.210:59158      192.9.11.180:55555      ESTABLISHED
tcp        0      0 127.0.0.1:48129         127.0.0.1:3306          TIME_WAIT

有看到3306这个字眼了,哈哈高兴一小下,server包安装成功了
如果没有3306的话,可能mysql没有启动,myslq start启动服务后再试
接下来client包:

linux-p33n:/home/xSwap/mysql # rpm -ivh MySQL-client-5.1.53-1.glibc23.i386.rpm
Preparing...                ########################################### [100%]
package MySQL-client-5.1.53-1.glibc23.i386 is already installed

package MySQL-client-5.1.53-1.glibc23.i386 is already installed

之前安这此包当然会此提示了,头次装的话不会出现些提示的

ok,安装完成!当然了安装成不成功我说了不算得测下看了:

linux-p33n:/home/xSwap/mysql # mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 220
Server version: 5.1.53 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

本篇文章来源于 Linux公社网站(www.linuxidc.com)  原文链接:http://www.linuxidc.com/Linux/2010-11/30175.htm





///安装后设置密码
法一:最简单的方法,也是安装完mysql后,系统提示的方法。使用mysqladmin来完成。
shell> mysqladmin -u root password "newpwd"
shell> mysqladmin -u root -h host_name password "newpwd"
password后面的双引号不是必须的,不过如果密码包含空格或者一些特殊的符号,需要用引号。

//设置远程root访问密码
mysql> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY '123456'  WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
mysql>

重启mysql服务器:# /etc/init.d/mysql restart


附上:网上摘来的片断:
在设置root账户密码时,可以选择是否允许其从远程访问。默认情况下是不允许的。

在命令行下,可以有两种大同小异的方法来作此设置:

(1)mysql>GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY 'something' WITH GRANT OPTION;

mysql>GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY 'something' WITH GRANT OPTION;

第一句增加了一个root用户授权通过本地机(localhost)访问,密码“something”。

第二句则是使用通配符,授与root用户从任何其它主机发起的访问。


(2)亦可直接使用update语句修改user表:使用root用户或其他用户登录mysql,转到mysql数据库

update user set host='localhost' where user='root';

flush privileges;//只允许root在本机登录

update user set host='%' where user='root';

flush privileges;//允许root远程访问

注意,以上一定要加flush语句。



分类:默认分类|回复:0|浏览:876|全站可见|转载
 

Powered by phpwind v8.7 Certificate Copyright Time now is:05-20 06:21
©2005-2016 QTCN开发网 版权所有 Gzip disabled