码迷,mamicode.com
首页 > 数据库 > 详细

LNMP源码编译安装之Mysql

时间:2018-04-27 16:51:19      阅读:216      评论:0      收藏:0      [点我收藏+]

标签:LNMP   Mysql   

Mysql 数据库
是一种关系型数据库管理软件,关系型数据库特点是将数据库保存在不同的二维表(Excel)中,并且将这些表放入不同的数据库中,而不是把所有数据统一放在一个大仓库里,这样的设计增加了Mysql的读取速度,灵活性和可管理性也得到了很大提高。访问及管理Mysql数据库的最常用标准化语言为SQL结构化查询语言。

Mysql安装

[root@web01 ~]# useradd -s /sbin/noligin mysql -M
[root@web01 tools]# mv mysql-5.5.49-linux2.6-x86_64 /application/mysql-5.5.49
[root@web01 tools]# cd /application/mysql-5.5.49/
[root@web01 tools]# ln -s /application/mysql-5.5.49/ /application/mysql
[root@web01 mysql]# chown -R mysql.mysql /application/mysql/
[root@web01 mysql]# ./scripts/mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysql   ?初始化

技术分享图片
修改配置文件

cd /application/mysql/bin
sed -i ‘s#/usr/local/#/application/#g‘ mysqld_safe 
sed -i ‘s#/usr/local/#/application/#g‘ support-files/mysql.server  
cp support-files/mysql.server /etc/init.d/mysqld  拷贝到启动脚本
chmod +x /etc/init.d/mysqld 赋予权限
[root@web01 bin]# less mysqld_safe

技术分享图片

指定配置文件

[root@web01 mysql]# cp support-files/my-small.cnf /etc/my.cnf 
cp:是否覆盖"/etc/my.cnf"? y
  • 启动数据库*
    [root@web01 mysql]# /application/mysql/bin/mysqld_safe --user=mysql &
    [1] 6953
    180411 21:35:31 mysqld_safe Logging to ‘/application/mysql/data/web01.err‘.
    180411 21:35:31 mysqld_safe Starting mysqld daemon with databases from /application/mysql/data
    PATH="/application/mysql/bin:$PATH"  设置环境变量
    echo "PATH="/application/mysql/bin:$PATH"" >>/etc/profile
    . /etc/profile
    [root@web01 mysql]# lsof -i :3306
    COMMAND  PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
    mysqld  7183 mysql   10u  IPv4  61272      0t0  TCP *:mysql (LISTEN)

启动关闭测试

[root@web01 mysql]# /etc/init.d/mysqld stop
Shutting down MySQL.180411 21:44:45 mysqld_safe mysqld from pid file /application/mysql/data/web01.pid ended
 SUCCESS! 
[1]+  Done                    /application/mysql/bin/mysqld_safe --user=mysql
[root@web01 mysql]# lsof -i :3306
[root@web01 mysql]# /etc/init.d/mysqld start
Starting MySQL... SUCCESS! 

Mysql数据库安装总结-脚化

useradd -s /sbin/noligin mysql -M
mkdir –p /application/
mkdir -p /home/oldboy/tools 
cd /home/oldboy/tools/
tar zxf mysql-5.5.49-linux2.6-x86_64.tar.gz
useradd -s /sbin/noligin mysql -M
mv mysql-5.5.49-linux2.6-x86_64 /application/mysql-5.5.49
cd /application/mysql-5.5.49/
ln -s /application/mysql-5.5.49/ /application/mysql
chown -R mysql.mysql /application/mysql/
./scripts/mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysql  
cd /application/mysql/bin
sed -i ‘s#/usr/local/#/application/#g‘ mysqld_safe 
cd ..
sed -i ‘s#/usr/local/#/application/#g‘ support-files/mysql.server
cp support-files/mysql.server /etc/init.d/mysqld  
chmod +x /etc/init.d/mysqld 
\cp support-files/my-small.cnf /etc/my.cnf
/application/mysql/bin/mysqld_safe --user=mysql &
PATH="/application/mysql/bin:$PATH"
echo "PATH="/application/mysql/bin:$PATH"" >>/etc/profile
. /etc/profile
lsof -i :3306
/etc/init.d/mysqld stop
chkconfig mysqld on 

LNMP源码编译安装之Mysql

标签:LNMP   Mysql   

原文地址:http://blog.51cto.com/jungiewolf/2108535

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!