CentOS 6.6 MySQL 5.5.32 绿色版安装配置
admin
2023-05-17 22:02:02
0

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后缀命名的


相关内容

热门资讯

500左右的手柄怎么选?swi... 现在游戏手柄早已成为热门数码外设,跟风入手的玩家数不胜数,但不清楚500左右的手柄怎么选的人同样不在...
原创 美... 2026年1月1日,美国太空探索技术公司“星链”工程副总裁迈克尔尼科尔斯高调宣布,计划2026年降低...
原创 全... 现在的屏幕设计,拥有两大类型,分别是折叠屏、直板机,而类型之间拥有多种形态。其中的折叠屏,拥有阔折叠...
原创 流... 最近,通信圈的两则消息引发了轩然大波。一方面,中国电信宣布自8月1日起全面停止第三方互联网渠道的办卡...
伊朗重申霍尔木兹海峡不会恢复至... △伊朗外交部发言人巴加埃(资料图)当地时间2日,伊朗外交部发言人巴加埃表示,伊方重申,霍尔木兹海峡的...
伊朗外长:与阿曼谈判接近完成 △伊朗外交部长阿拉格齐(中)当地时间8月2日,伊朗外交部长阿拉格齐在政府内阁会议上介绍伊朗与阿曼谈判...
河南2026年“三支一扶”计划... 针对近期备受关注的2026年河南省“三支一扶”计划招募相关舆情,河南省“三支一扶”领导小组协调办公室...
以卵击石的“汉光演习”不过是一... 昨天题为《人民解放军越强大,台海和平越有保障》的海风文章,已经反映了一部分台海局势的现实。若再把8月...
美国一养老社区将推出面向老人的... 据《独立报》8月1日报道,美国亚利桑那州一养老社区将引入一台专为老年人设计的大麻自助售卖机,居民无需...
“你头发都白了”,同守广西边防... “你头发都白了,模样还是没变,就是没有年轻时候那么帅了。”