CentOS 6.6 MySQL 5.5.32 綠色版安裝配置

來源:互聯網
上載者:User

標籤:mysql 5.5.32 綠色版安裝配置   linux   centos 6.6   

MySQL 5.5.32 綠色版安裝配置

 

  1. 基本資料

系統版本:CentOS 6.6

MySQL版本:5.5.32 綠色版

 

  1. 初始化MySQL,出現黃色部分兩個OK,表示初始化正確

[[email protected] tools]# useradd -s/sbin/nologin -M mysql

[[email protected] tools]# tar zxvfmysql-5.5.32-linux2.6-x86_64.tar.gz

[[email protected] tools]# mvmysql-5.5.32-linux2.6-x86_64  /application/mysql-5.5.32

[[email protected] tools]# ln -s/application/mysql-5.5.32  /application/mysql

[[email protected] 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啟動指令碼裡的路徑

[[email protected] ~]# chown -Rmysql.mysql /application/mysql/

[[email protected] ~]# cp /application/mysql/support-files/my-small.cnf /etc/my.cnf

[[email protected] ~]# sed -i‘s#/usr/local/mysql#/application/mysql#g‘ /application/mysql/bin/mysqld_safe     ###修改指令碼裡的安裝路徑

[[email protected] ~]#/application/mysql/bin/mysqld_safe &  ###以後台進程方式啟動MySQL

 

  1. 查看MySQL是否正常啟動

[[email protected] ~]# lsof -i:3306

[[email protected] ~]# netstat-tulpn|grep 3306

[[email protected] ~]# ps -ef|grepmysql

 

  1. 配置環境變數

[[email protected] ~]# echo"PATH=/application/mysql/bin:$PATH" >>/etc/profile

[[email protected] ~]# source/etc/profile

[[email protected] ~]# which mysql    ###確定是否是綠色版的MySQL而不是yum安裝的MySQL

/application/mysql/bin/mysql

 

  1. 登陸MySQL

[[email protected] ~]# 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

[[email protected] ~]# cp/application/mysql/support-files/mysql.server /etc/init.d/mysqld

[[email protected] ~]# sed -i‘s#/usr/local/mysql#/application/mysql#g‘ /etc/init.d/mysqld  ##修改mysql安裝路徑

[[email protected] ~]# killall mysqld   ###殺死之前啟動的mysql進程

[[email protected] ~]# lsof -i:3306    ###確認是否已殺死mysql進程

[[email protected] ~]#/etc/init.d/mysqld start   ###以傳統方式重新啟動mysql進程

 

  1. 設定mysql管理員密碼,預設管理員是root使用者

[[email protected] ~]# mysqladmin-uroot password "123456"

[[email protected] ~]# mysql -uroot-p123456   ###登陸mysql,注意,-p和密碼之間不能有空格

[[email protected] ~]# mysqladmin-uroot -p123456 password "wangning" ###更改密碼

 

  1. 查看錯誤記錄檔

[[email protected] ~]# cat  /application/mysql/data/lnmp02.err    ###該錯誤記錄檔檔案是以主機名稱加.err尾碼命名的


本文出自 “飛奔的駱駝” 部落格,請務必保留此出處http://wn2100.blog.51cto.com/9915310/1941597

CentOS 6.6 MySQL 5.5.32 綠色版安裝配置

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.