LAMP架构下,然后搭建LNMP架构 1.首先查看mysql是否启动 ps aux |grep mysql 2.删除目录 rm -rf /usr/local/mysql/ 3.删除启动的脚本 rm -rf /etc/init.d/mysqld 4.然后其他步骤相同
[root@hanfeng ~]# cd /usr/local/src [root@hanfeng src]#
[root@hanfeng src]# wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
[root@hanfeng src]# tar zxvf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
[root@hanfeng src]# mv mysql-5.6.35-linux-glibc2.5-x86_64 /usr/local/mysql [root@hanfeng src]#
[root@hanfeng src]# ls /usr/local/mysql bin data include man README share support-files COPYING docs lib mysql-test scripts sql-bench [root@hanfeng src]#
[root@hanfeng src]# cd /usr/local/mysql [root@hanfeng mysql]#
[root@hanfeng mysql]# useradd mysql [root@hanfeng mysql]# mkdir /data/ [root@hanfeng mysql]#
[root@hanfeng mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
FATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db: Data::Dumper
yum install -y perl-Data-Dumper
Installing MySQL system tables..../bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
yum install -y libaio
[root@hanfeng mysql]# echo $? 0 [root@hanfeng mysql]#
[root@hanfeng mysql]# cp support-files/mysql.server /etc/init.d/mysqld
[root@hanfeng mysql]# vim /etc/init.d/mysqld 在文件中配置 basedir=/usr/local/mysql datadir=/data/mysql 然后保存退出
[root@hanfeng mysql]# /etc/init.d/mysqld start Starting MySQL.Logging to '/data/mysql/hanfeng.err'. . SUCCESS! [root@hanfeng mysql]#
[root@hanfeng mysql]# ps aux |grep mysql root 2295 0.0 0.1 113252 1608 pts/0 S 22:41 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/hanfeng.pid mysql 2403 1.9 44.6 973512 451180 pts/0 Sl 22:41 0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/hanfeng.err --pid-file=/data/mysql/hanfeng.pid root 2429 0.0 0.0 112656 992 pts/0 R+ 22:41 0:00 grep --color=auto mysql [root@hanfeng mysql]#
[root@hanfeng mysql]# chkconfig --add mysqld [root@hanfeng mysql]# chkconfig mysqld on [root@hanfeng mysql]#
[root@hanfeng mysql]# service mysqld stop Shutting down MySQL.. SUCCESS! [root@hanfeng mysql]# service mysqld start Starting MySQL. SUCCESS!
本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。
我来说两句