CentOS 6.6 MySQL 5.5.32 绿色版安装配置

前端之家收集整理的这篇文章主要介绍了CentOS 6.6 MySQL 5.5.32 绿色版安装配置前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

MysqL 5.5.32 绿色版安装配置

  1. 基本信息

系统版本:CentOS 6.6

MysqL版本:5.5.32 绿色版

  1. 初始化MysqL,出现黄色部分两个OK,表示初始化正确

[root@lnmp02 tools]# useradd -s/sbin/nologin -M MysqL

[root@lnmp02 tools]# tar zxvfMysqL-5.5.32-linux2.6-x86_64.tar.gz

[root@lnmp02 tools]# mvMysqL-5.5.32-linux2.6-x86_64 /application/MysqL-5.5.32

[root@lnmp02 tools]# ln -s/application/MysqL-5.5.32 /application/MysqL

[root@lnmp02 application]#/application/MysqL/scripts/MysqL_install_db --basedir=/application/MysqL/--datadir=/application/MysqL/data/ --user=MysqL

Installing MysqL system tables...

OK

Filling help tables...

OK

To start MysqLd at boot timeyou have to copy

support-files/MysqL.server tothe right place for your system

PLEASE REMEMBER TO SET APASSWORD FOR THE MysqL root USER !

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

/application/MysqL//bin/MysqLadmin-u root password 'new-password'

/application/MysqL//bin/MysqLadmin-u root -h lnmp02 password 'new-password'

Alternatively you can run:

/application/MysqL//bin/MysqL_secure_installation

which will also give you theoption of removing the test

databases and anonymous usercreated by default. This is

strongly recommended forproduction servers.

See the manual for moreinstructions.

You can start the MysqL daemonwith:

cd /application/MysqL/ ;/application/MysqL//bin/MysqLd_safe &

You can test the MysqL daemonwith MysqL-test-run.pl

cd/application/MysqL//MysqL-test ; perl MysqL-test-run.pl

Please report any problems withthe /application/MysqL//scripts/MysqLbug script!

  1. 改变/application/MysqL所属主和组,cp配置文件,改变MysqL启动脚本里的路径

[root@lnmp02 ~]# chown -RMysqL.MysqL /application/MysqL/

[root@lnmp02 ~]# cp /application/MysqL/support-files/my-small.cnf/etc/my.cnf

[root@lnmp02 ~]# sed -i's#/usr/local/MysqL#/application/MysqL#g'/application/MysqL/bin/MysqLd_safe###修改脚本里的安装路径

[root@lnmp02 ~]#/application/MysqL/bin/MysqLd_safe &###后台进程方式启动MysqL

  1. 查看MysqL是否正常启动

[root@lnmp02 ~]# lsof -i:3306

[root@lnmp02 ~]# netstat-tulpn|grep 3306

[root@lnmp02 ~]# ps -ef|grepMysqL

  1. 配置环境变量

[root@lnmp02 ~]# echo"PATH=/application/MysqL/bin:$PATH" >>/etc/profile

[root@lnmp02 ~]# source/etc/profile

[root@lnmp02 ~]# which MysqL ###确定是否是绿色版的MysqL而不是yum安装的MysqL

/application/MysqL/bin/MysqL

  1. 登陆MysqL

[root@lnmp02 ~]# MysqL

Welcome to the MysqLmonitor. Commands end with ; or \g.

Your MysqL connection id is 3

Server version: 5.5.32 MysqLCommunity Server (GPL)

Copyright (c) 2000,2013,Oracle and/or its affiliates. All rights reserved.

Oracle is a registeredtrademark of Oracle Corporation and/or its

affiliates. Other names may betrademarks of their respective

owners.

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

MysqL>

  1. 配置传统方式启动MysqL

[root@lnmp02 ~]# cp/application/MysqL/support-files/MysqL.server /etc/init.d/MysqLd

[root@lnmp02 ~]# sed -i's#/usr/local/MysqL#/application/MysqL#g' /etc/init.d/MysqLd ##修改MysqL安装路径

[root@lnmp02 ~]# killall MysqLd ###杀死之前启动的MysqL进程

[root@lnmp02 ~]# lsof -i:3306 ###确认是否已杀死MysqL进程

[root@lnmp02 ~]#/etc/init.d/MysqLd start ###以传统方式重新启动MysqL进程

  1. 设置MysqL管理员密码,默认管理员root用户

[root@lnmp02 ~]# MysqLadmin-uroot password "123456"

[root@lnmp02 ~]# MysqL -uroot-p123456 ###登陆MysqL,注意,-p和密码之间不能有空格

[root@lnmp02 ~]# MysqLadmin-uroot -p123456 password "wangning"###更改密码

  1. 查看错误日志

[root@lnmp02 ~]# cat /application/MysqL/data/lnmp02.err ###错误日志文件是以主机名加.err后缀命名的

原文链接:https://www.f2er.com/centos/377058.html

猜你在找的CentOS相关文章