mysql 配置 suse 11_MySQL SUSE SLES11安装与配置笔记实操

以下的文章主要介绍的是MySQL SUSE SLES11安装与配置笔记的实际操作过程,我们是在Linux下两个不同的版本MySQL安装实战(MySQL5和MySQL4)演示,以下就是文章的而具体内容描述。 Redhat9.2 安装MySQL5.0 fedora7安装MySQL (1) 下载 从MySQL官网 下载到最新的

以下的文章主要介绍的是MySQL SUSE SLES11安装与配置笔记的实际操作过程,我们是在Linux下两个不同的版本MySQL安装实战(MySQL5和MySQL4)演示,以下就是文章的而具体内容描述。

Redhat9.2 安装MySQL5.0

fedora7安装MySQL

(1) 下载

从MySQL官网 下载到最新的发行版本5.1.45,简单起见,直接下载SLES11的RPM版本:

MySQL-server-community-5.1.45-1.sles11.i586.rpm

MySQL-client-community-5.1.45-1.sles11.i586.rpm

MySQL-shared-community-5.1.45-1.sles11.i586.rpm

对MySQL版本的选择,个人意见,如果是作为产品首先考虑稳定性和性能,功能够用即可,版本上谨慎保守一些,但是作为一般开发用用,追追新也无所谓。

(2) MySQL SUSE SLES11 安装

1. rpm安装

执行:rpm -ivh MySQL-server-community-5.1.45-1.sles11.i586.rpm

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

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

MySQL0:off 1:off 2:on 3:on 4:on 5:on 6:off

PLEASE REMEMBER TO SET A PASSWORD FOR THEMySQLroot 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 ss-server 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!

StartingMySQL. done

GivingMySQLd 2 seconds to start

使用ps -ef | grep MySQL 可以看到msyqld进行已经启动。netstat -nat 可以看到默认的3306端口已经在监听。rpm的安装的确是够简单。

tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN

但是这样的默认安装,是没有指定安装路径的,因此MySQL不会MySQL SUSE SLES11 安装到我们期望的地点。因此只好重新来过,先卸载吧:

rpm -e MySQL-server-community-5.1.45-1.sles11

使用--prefix选项重新安装:

rpm -ivh --prefix=/work/soft/database/MySQL/ MySQL-server-community-5.1.45-1.sles11.i586.rpm

结果发生错误:

error: package MySQL-server-community is not relocatable

居然不能重新定位MySQL SUSE SLES11 安装路径,这个就麻烦了。只好重新下载tarbell的版本MySQL-5.1.45.tar.gz,自己动手编译。

2. 编译

./configure --prefix=/work/soft/database/MySQL/MySQL5.1 --localstatedir=/work/soft/database/MySQL/MySQLdata --with-charset=utf8 --with-extra-charsets=all --with-client-ldflags=-all-static --with-MySQLd-ldflags=-all-static --with-unix-socket-path=/work/soft/database/MySQL/tmp/MySQL.sock

configure的过程中出现错误而中断:

checking for termcap functions library... configure: error: No curses/termcap library found

先把这个东西装好

gunzip ncurses-5.7.tar.gz

tar xvf ncurses-5.7.tar

cd ncurses-5.7/

./configure

make

make install

安装ncurses之后,重新configure成功,继续make,make install完成编译MySQL SUSE SLES11 安装。

然后执行scripts/MySQL_install_db.

Installing MySQL system tables...

OK

Filling help tables...

OK

To startMySQLd at boot time you have to copy

support-files/MySQL.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THEMySQLroot USER !

To do so, start the server, then issue the following commands:

/work/soft/database/MySQL/MySQL5.1/bin/MySQLadmin -u root password 'new-password'

/work/soft/database/MySQL/MySQL5.1/bin/MySQLadmin -u root -h ss-server password 'new-password'

Alternatively you can run:

/work/soft/database/MySQL/MySQL5.1/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.

You can start theMySQLdaemon with:

cd /work/soft/database/MySQL/MySQL5.1 ; /work/soft/database/MySQL/MySQL5.1/bin/MySQLd_safe &

You can test theMySQLdaemon withMySQL-test-run.pl

cd /work/soft/database/MySQL/MySQL5.1/MySQL-test ; perlMySQL-test-run.pl

Please report any problems with the /work/soft/database/MySQL/MySQL5.1/bin/MySQLbug script!

接着很重要的事情,设置MySQLd的开机启动:

cp support-files/MySQL.server /etc/init.d/MySQL

chkconfigMySQLon

为了方便,将MySQL 的bin目录加到PATH中,在/etc/profile中加入myslq/bin,顺便增加两个别名方便操作:

export PATH=$JAVA_HOME/bin:$SOFT_ROOT/database/MySQL/MySQL5.1/bin:$PATH

aliasMySQL_start="MySQLd_safe&"

aliasMySQL_stop="MySQLadmin -uroot -p shutdown"

3. 配置

按照普遍推荐的标准设置,需要增加MySQL的user和group:不过上面的MySQL SUSE SLES11 安装过程结束后,发现已经存在名为MySQL的user和group了:

ss-server:/etc # groupadd MySQL

groupadd: Group `MySQL' already exists.

ss-server:/etc # useraddMySQL-gMySQL

useradd: Account `MySQL' already exists.

用ps命令可以看到

ss-server:/etc # ps -ef | grep MySQL

root 3743 1 0 18:58 ? 00:00:00 /bin/sh

/work/soft/database/MySQL/MySQL5.1/bin/MySQLd_safe--datadir=

/work/soft/database/MySQL/MySQLdata--pid-file=/

work/soft/database/MySQL/MySQLdata/ss-server.pid

MySQL3799 3743 0 18:58 ? 00:00:00 /work/soft/database/MySQL/MySQL5.1

/libexec/MySQLd--basedir=/work/soft/database/MySQL/MySQL5.1--datadir=/work/soft/database/MySQL/MySQLdata--user=MySQL--log-error=/work/soft/database/MySQL/MySQLdata/ss-server.err--pid-file=/work/soft

/database/MySQL/MySQLdata/ss-server.pid

这里MySQLd是以MySQL用户的身份启动的。

以下是标准的MySQL SUSE SLES11 安装设置了

1. 设置root帐户的密码

MySQLadmin -u root password 'yourpassword'

2. 本机登录MySQL, 需要做的事情有: 删除本机匿名连接的空密码帐号;容许root用户是不允许远程登录。

MySQL-uroot -p

然后输入上面设置的密码,登录后在MySQL的命令行中执行:

MySQL>use MySQL;

MySQL>delete from user wherepassword="";

MySQL>update user sethost='%'whereuser='root';

MySQL>flush privileges;

MySQL>quit

对于root账号,如果考虑安全应该新建其他账号用于远程登录,root账号可以不必开启远程登录。不过对于一般使用,没有太多安全需求,允许root用户远程登录可以方便管理,毕竟使用专用管理软件的图形界面在操作方面要方便的多。

f68f2add0b68e4f9810432fce46917b7.png

本文原创发布php中文网,转载请注明出处,感谢您的尊重!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值