Centos 源码安装 MySQL

前端之家收集整理的这篇文章主要介绍了Centos 源码安装 MySQL前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

系统环境:Centos6.5

1、下载源码包

[monster@localhost download]$wgethttp://mirrors.sohu.com/MysqL/MysqL-5.5/MysqL-5.5.49-linux2.6-x86_64.tar.gz

解压到 /usr/local/ 目录下

[monster@localhost download]$ cd /usr/local/
[monster@localhost local]$ sudo tar -xf /opt/download/MysqL-5.5.49-linux2.6-x86_64.tar.gz

为了方便后续操作,为该目录建立符号链接

[monster@localhost local]$ sudo ln -s MysqL-5.5.49-linux2.6-x86_64/ MysqL

2、检查是否安装了相应的软件包

[monster@localhost local]$ sudo rpm -qa | grep -i MysqL

如果已安装了相应的xxxxx,为了防止安装时覆盖错误,先卸载xxxxx,注意加--nodeps选项,忽略依赖项

[monster@localhost local]$ sudo rpm -exxxxx --nodeps

/usr/local/MysqL目录结构


3、添加MysqL组和MysqL用户,用于设置MysqL安装目录文件的所有者和所属组

[monster@localhost local]$ sudo groupadd MysqL

[monster@localhost local]$ sudo useradd -r -g MysqL

4、更改MysqL目录所属组和用户

[monster@localhost local]$ cd MysqL

[monster@localhost MysqL]$ sudo chown -R MysqL:MysqL .

5、初始化数据库

[monster@localhost mysql]$ sudoscripts/MysqL_install_db --user=MysqL

6、拷贝配置文件

[monster@localhost mysql]$ sudo cp support-files/my-medium.cnf /etc/my.cnf

7、将MysqLd服务加入开机自启

[monster@localhost MysqL]$ sudo cp support-files/MysqL.server /etc/init.d/MysqLd

[monster@localhost MysqL]$ sudo chkconfig --add MysqLd

8、启动MysqLd服务

[monster@localhost MysqL]$ sudo service MysqLd start

9、设置数据库root密码,登录MysqL

[monster@localhost MysqL]$ sudo bin/MysqLadmin -u root password 'password'

[monster@localhost MysqL]$ bin/MysqL -u root -p
Enter password:
Welcome to the MysqL monitor. Commands end with ; or \g.
Your MysqL connection id is 3
Server version: 5.5.49-log MysqL Community Server (GPL)

Copyright (c) 2000,2016,Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MysqL> quit Bye

原文链接:https://www.f2er.com/centos/381427.html

猜你在找的CentOS相关文章