MySQL 5.5.32绿色版安装配置
专注于为中小企业提供成都做网站、成都网站制作服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业徐闻免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了近千家企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。基本信息
系统版本:CentOS 6.6
MySQL版本:5.5.32 绿色版
初始化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!
改变/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
查看MySQL是否正常启动
[root@lnmp02 ~]# lsof -i:3306
[root@lnmp02 ~]# netstat-tulpn|grep 3306
[root@lnmp02 ~]# ps -ef|grepmysql
配置环境变量
[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
登陆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>
配置传统方式启动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进程
设置mysql管理员密码,默认管理员是root用户
[root@lnmp02 ~]# mysqladmin-uroot password "123456"
[root@lnmp02 ~]# mysql -uroot-p123456 ###登陆mysql,注意,-p和密码之间不能有空格
[root@lnmp02 ~]# mysqladmin-uroot -p123456 password "wangning" ###更改密码
查看错误日志
[root@lnmp02 ~]# cat /application/mysql/data/lnmp02.err ###该错误日志文件是以主机名加.err后缀命名的
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。