MySQL 5.5.32綠色版安裝配置
我們提供的服務(wù)有:成都網(wǎng)站制作、成都做網(wǎng)站、微信公眾號(hào)開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、保定ssl等。為數(shù)千家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的保定網(wǎng)站制作公司
基本信息
系統(tǒng)版本:CentOS 6.6
MySQL版本:5.5.32 綠色版
初始化MySQL,出現(xiàn)×××部分兩個(gè)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啟動(dòng)腳本里的路徑
[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 & ###以后臺(tái)進(jìn)程方式啟動(dòng)MySQL
查看MySQL是否正常啟動(dòng)
[root@lnmp02 ~]# lsof -i:3306
[root@lnmp02 ~]# netstat-tulpn|grep 3306
[root@lnmp02 ~]# ps -ef|grepmysql
配置環(huán)境變量
[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>
配置傳統(tǒng)方式啟動(dòng)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 ###殺死之前啟動(dòng)的mysql進(jìn)程
[root@lnmp02 ~]# lsof -i:3306 ###確認(rèn)是否已殺死m(xù)ysql進(jìn)程
[root@lnmp02 ~]#/etc/init.d/mysqld start ###以傳統(tǒng)方式重新啟動(dòng)mysql進(jìn)程
設(shè)置mysql管理員密碼,默認(rèn)管理員是root用戶
[root@lnmp02 ~]# mysqladmin-uroot password "123456"
[root@lnmp02 ~]# mysql -uroot-p123456 ###登陸mysql,注意,-p和密碼之間不能有空格
[root@lnmp02 ~]# mysqladmin-uroot -p123456 password "wangning" ###更改密碼
查看錯(cuò)誤日志
[root@lnmp02 ~]# cat /application/mysql/data/lnmp02.err ###該錯(cuò)誤日志文件是以主機(jī)名加.err后綴命名的