CentOS 6.6 MySQL 5.5.32 绿色版安装配置

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介:
  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后缀命名的




本文转自 茁壮的小草 51CTO博客,原文链接:http://blog.51cto.com/wn2100/1941597,如需转载请自行联系原作者
相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
1月前
|
存储 SQL 关系型数据库
创建并配置RDS实例
在阿里云上创建RDS实例涉及登录控制台、进入RDS管理页面、创建实例、选择数据库引擎和版本、配置实例规格与存储、设定网络与安全组、设置实例信息、确认订单并支付,最后初始化数据库。操作步骤可能因界面更新或数据库引擎不同略有差异。
19 1
|
15天前
|
关系型数据库 MySQL Linux
linux CentOS 7.4下 mysql5.7.20 密码改简单的方法
linux CentOS 7.4下 mysql5.7.20 密码改简单的方法
19 0
|
15天前
|
SQL 缓存 关系型数据库
mysql性能优化-慢查询分析、优化索引和配置
mysql性能优化-慢查询分析、优化索引和配置
80 1
|
21天前
|
缓存 关系型数据库 MySQL
MySQL查询优化:提速查询效率的13大秘籍(合理使用索引合并、优化配置参数、使用分区优化性能、避免不必要的排序和group by操作)(下)
MySQL查询优化:提速查询效率的13大秘籍(合理使用索引合并、优化配置参数、使用分区优化性能、避免不必要的排序和group by操作)(下)
|
1天前
|
运维 网络协议 Linux
【运维系列】Centos7安装并配置PXE服务
PXE是Intel开发的预启动执行环境,允许工作站通过网络从远程服务器启动操作系统。它依赖DHCP分配IP,DNS服务分配主机名,TFTP提供引导程序,HTTP/FTP/NFS提供安装源。要部署PXE服务器,需关闭selinux和防火墙,安装dhcpd、httpd、tftp、xinetd及相关服务,配置引导文件和Centos7安装源。最后,通过syslinux安装引导文件,并创建pxelinux.cfg/default配置文件来定义启动参数。
5 0
|
1天前
|
运维 网络协议 Linux
【运维系列】Centos7安装并配置postfix服务
安装CentOS7的Postfix和Dovecot,配置Postfix的`main.cf`文件,包括修改完全域名、允许所有IP、启用邮箱等。然后,配置Dovecot的多个配置文件以启用auth服务和调整相关设置。重启Postfix和Dovecot,设置开机自启,并关闭防火墙进行测试。最后,创建邮箱账户并在Windows邮箱客户端中添加账户设置。
9 0
|
1天前
|
运维 Linux 网络安全
【运维系列】Centos7安装配置ntp服务
配置yum并安装ntp,编辑ntp配置文件,取消17行注释,适应本机网段,22行设置使用本地时间。关闭防火墙,重启ntp服务。测试时先关闭防火墙,然后使用ntpdate命令成功同步时间。
4 0
|
1天前
|
Linux 网络安全
Centos6.5安装并配置NFS服务
该内容描述了在Linux系统中设置NFS服务的步骤。首先挂载yum源,然后安装NFS服务,并编辑配置文件。接着,重启rpcbind和NFS服务,可能需要重复此过程以解决初始可能出现的问题。此外,关闭防火墙策略,并再次重启服务。最终,根目录被共享,特定IP网段被允许访问。
7 0
|
8天前
|
关系型数据库 MySQL Linux
centos7安装mysql-带网盘安装包
centos7安装mysql-带网盘安装包
53 2
|
15天前
|
网络协议
centos8 网卡 Nmcli(是network的简写 Nmcli)配置网络
centos8 网卡 Nmcli(是network的简写 Nmcli)配置网络
15 0