LNMP源码编译安装之Mysql
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LNMP源码编译安装之Mysql相关的知识,希望对你有一定的参考价值。
Mysql 数据库
是一种关系型数据库管理软件,关系型数据库特点是将数据库保存在不同的二维表(Excel)中,并且将这些表放入不同的数据库中,而不是把所有数据统一放在一个大仓库里,这样的设计增加了mysql的读取速度,灵活性和可管理性也得到了很大提高。访问及管理Mysql数据库的最常用标准化语言为SQL结构化查询语言。
Mysql安装
[[email protected] ~]# useradd -s /sbin/noligin mysql -M
[[email protected] tools]# mv mysql-5.5.49-linux2.6-x86_64 /application/mysql-5.5.49
[[email protected] tools]# cd /application/mysql-5.5.49/
[[email protected] tools]# ln -s /application/mysql-5.5.49/ /application/mysql
[[email protected] mysql]# chown -R mysql.mysql /application/mysql/
[[email protected] 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 赋予权限
[[email protected] bin]# less mysqld_safe
指定配置文件
[[email protected] mysql]# cp support-files/my-small.cnf /etc/my.cnf
cp:是否覆盖"/etc/my.cnf"? y
- 启动数据库*
[[email protected] 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 [[email protected] mysql]# lsof -i :3306 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME mysqld 7183 mysql 10u IPv4 61272 0t0 TCP *:mysql (LISTEN)
启动关闭测试
[[email protected] 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
[[email protected] mysql]# lsof -i :3306
[[email protected] 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的主要内容,如果未能解决你的问题,请参考以下文章