`
caiying0504
  • 浏览: 334665 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

SUSE11 下 mysql 的安装配置

阅读更多
SUSE SLES11 上安装配置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) 安装

1. rpm安装

执行:
rpm -ivh MySQL-server-community-5.1.45-1.sles11.i586.rpm 
Preparing...                ########################################### [100%]
   1:MySQL-server-community ########################################### [100%]
mysql                     0:off  1:off  2:on   3:on   4:on   5:on   6:off

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 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!

Starting MySQL.                                                       done
Giving mysqld 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不会安装到我们期望的地点。因此只好重新来过,先卸载吧:
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
居然不能重新定位安装路径,这个就麻烦了。只好重新下载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


参数比较复杂,重要参考了以下两个google的文章:
mysql configure 参数
http://ipopeye.iteye.com/blog/351536
Mysql编译安装参数优化
http://www.iteye.com/topic/123197

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

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

少东西了,没的说,找到http://www.gnu.org/software/ncurses/,下载到最新版本
http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.7.tar.gz

先把这个东西装好
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完成编译安装。

然后执行
scripts/mysql_install_db.

Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld 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 THE MySQL root 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 the MySQL daemon with:
cd /work/soft/database/mysql/mysql5.1 ; /work/soft/database/mysql/mysql5.1/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /work/soft/database/mysql/mysql5.1/mysql-test ; perl mysql-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
chkconfig mysql on

为了方便,将mysql 的bin目录加到PATH中,在/etc/profile中加入myslq/bin,顺便增加两个别名方便操作:
export PATH=$JAVA_HOME/bin:$SOFT_ROOT/database/mysql/mysql5.1/bin:$PATH
alias mysql_start="mysqld_safe&"
alias mysql_stop="mysqladmin  -uroot -p shutdown"

3. 配置

按照普遍推荐的标准设置,需要增加mysql的user和group:不过上面的安装过程结束后,发现已经存在名为mysql的user和group了:
ss-server:/etc # groupadd mysql
groupadd: Group `mysql' already exists.
ss-server:/etc # useradd mysql -g mysql
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
mysql     3799  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安装设置了
1. 设置root帐户的密码
mysqladmin -u root password 'yourpassword'


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

mysql -uroot -p

然后输入上面设置的密码,登录后在mysql的命令行中执行:
mysql>use mysql;
mysql>delete from user where password="";
mysql>update user set host = '%' where user = 'root';
mysql>flush privileges;
mysql>quit

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


至此,mysql的安装配置完成,可以使用了,收工!
分享到:
评论

相关推荐

    SUSE11安装MySql

    MySQL SUSE SLES11安装与配置笔记实操 SUSE 企业版 11 更改MYSQL安装目录(经过实测) 本人在SuSe11下rpm安装mysql包的整个过程,感谢网络感谢网友 (均摘自网上)

    suse源码安装mysql5.5配置

    suse11版本64位 源码安装mysql5.5配置文档

    mysql在SUSE中的安装与启动

    mysql 在SUSE下的安装及配置说明

    Suse Linux 10中MySql安装与配置步骤

    主要介绍了Suse Linux 10中MySql安装与配置步骤,本文详细的讲解了安装步骤,需要的朋友可以参考下

    Linux下安装mysql-8.0.20的教程详解

    Linux下安装mysql-8.0.20 ** 环境介绍 操作系统:CentOS 7 mysql下载地址:https://dev.mysql.com/downloads/mysql/ 下载版本:https://www.jb51.net/softs/609101.html https://www.jb51.net/softs/609101.html ...

    SUSE Linux下源码编译方式安装MySQL 5.6过程分享

    本文描述了如何在源码方式下安装MySQL。 1、安装环境及介质 代码如下: #安装环境 SZDB:~ # cat /etc/issue Welcome to SUSE Linux Enterprise Server 10 SP3 (x86_64) – Kernel \r (\l). SZDB:~ # unam

    cacti_suse_64_sp4所有都是源码包安装说明

    cacti_suse_64_sp4所有都是源码包安装说明:是全程采用源码包安装,适用于所有LINUX系统的安装,包括解决乱码,图出不来,以及安装过程配置客户端被监控的对应内容都有详细说明

    MySQL 5权威指南(第3版) 中文版 下载地址

     2.3 在SUSE Linux 9.3系统上安装MySQL和相关软件  2.4 在Red Hat Enterprise Linux 4系统上安装MySQL和相关软件  2.5 编译MySQL软件的开发者版本(Linux)  2.6 配置Apache  2.7 配置PHP  2.8 配置MySQL...

    MySQL5 权威指南第3版中文版_part1

     2.3 在SUSE Linux 9.3系统上安装MySQL和相关软件  2.4 在Red Hat Enterprise Linux 4系统上安装MySQL和相关软件  2.5 编译MySQL软件的开发者版本(Linux)  2.6 配置Apache  2.7 配置PHP  2.8 配置MySQL  第...

    Linux下安装PHP MSSQL扩展教程

    首先说明下,服务器的系统版本为SUSE Linux Enterprise Server 10 SP3。 1. 安装FreeTDS 地址:FreeTDS 复制代码 代码如下: wget http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz tar zxvf ...

    java.sql.SQLException: null,  message from server: “Host ‘%’ is not allowed to connect to

    在阿里云 SUSE linux配置完mysql后,服务器端本身是可以访问数据库的如图: 但是在客户端不可以,服务启动时报错: java.sql.SQLException: null, message from server: “Host ‘223.72.41.7’ is not allowed to ...

    LTMP:LTMP(CentOSTengineMySQLPHP)

    这篇文章较为详细的描述了基于LTMP架构的部署过程,之后会再考虑独立各个模块分享细节和技巧,如果大家有更合适的配置实践手册欢迎一起分享,文章中的错误和改进点也请帮忙指点下哈。 LTMP(CentOS/Tengine/MySQL/PHP...

    mapr-puppet:用于部署 MapR Hadoop 发行版的 Puppet 模块,版本 4.x+

    配置 mysql 和指标数据库。 申请许可证。 创建默认卷。 为 mapr 客户端节点创建“角色”。 安装支持 MapR-DB 的 OpenTSDB。 设置 在所有节点上设置主机名和 /etc/hosts 确保在所有节点上都安装了 Puppet rpm ...

    CIS benchmarks.rar

    CIS_SUSE_Linux_Enterprise_12_Benchmark_v2.1.0.pdf CIS_Ubuntu_Linux_16.04_LTS_Benchmark_v1.1.0.pdf CIS_Ubuntu_Linux_18.04_LTS_Benchmark_v2.0.1.pdf CIS_VMware_ESXi_6.5_Benchmark_v1.0.0.pdf CIS_VMware_...

    javapms门户网站源码

    双击某条管理员角色信息所在行,可以查看该管理员角色的详细信息,对管理员的管理权限进行配置,如下图所示: 2.5.5. 部门管理 部门是对管理员数据管理范围的设置,管理员能管理信息的多少直接和部门挂钩。点击...

    杰奇1.7完全功能破解版(含注册机及wap)

    操作系统 Windows,Linux(推荐)/Unix,包括 RedHat、SuSE Linux、Debian 以及 FreeBSD、OpenBSD 等, PHP 运行环境 PHP版本需要 4.33 以上,推荐官方稳定版,并且安装了 Zend Optimizer 3.0以上 MySQL 数据库 要...

Global site tag (gtag.js) - Google Analytics