Linux+Apache+Mysql/MariaDB+Perl/PHP/Python一组经常使用来搭建动态网站或者服务器的开源软件,自己都是各自独立的程序,可是由于常被放在一块儿使用,拥有了愈来愈高的兼容度,共同组成了一个强大的Web应用程序平台。随着开源潮流的蓬勃发展,开放源代码的LAMP已经与J2EE和.Net商业软件造成三足鼎立之势,而且该软件开发的项目在软件方面的投资成本较低,所以受到整个IT界的关注。从网站的流量上来讲,70%以上的访问流量是LAMP来提供的,LAMP是最强大的网站解决方案mysql
MySQL安装有三种方式,rpm包,源码包,二进制免编译包linux
以二进制免编译包安装举例: MySQL 5.6 64位的包下载地址:http://mirrors.163.com/mysql/Downloads/MySQL-5.6/mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz ,若是找不到合适的包能够浏览一个网站:r.aminglinux.com来查找相对应的包sql
[root@localhost src]# mv mysql-5.6.39-linux-glibc2.12-x86_64 /usr/local/mysql [root@localhost src]# cd /usr/local/mysql/ [root@localhost mysql]# ls bin COPYING data docs include lib man mysql-test README scripts share sql-bench support-files
[root@localhost mysql]# useradd mysql [root@localhost mysql]# mkdir /data/
[root@localhost 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 [root@localhost mysql]# yum list | grep perl |grep -i dumper perl-Data-Dumper.x86_64 2.145-3.el7 base perl-XML-Dumper.noarch 0.81-17.el7 base
搜索到两个,能够依次安装尝试一下。安装完第一后再执行./scripts/mysql_install_db --user=mysql --datadir=/data/mysql 发现已经能够正常安装了。** 若是不知道安装是否成功,能够执行echo $? ,这条命令是验证上一条命令是否有问题 ,若是是0 就表明没有问题 **服务器
[mysqld] datadir=/data/mysql 数据目录须要指定 socket=/tmp/mysql.sock socket须要之赐你个 # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Settings user and group are ignored when systemd is used. # If you need to run mysqld under a different user or group, # customize your systemd unit file for mariadb according to the # instructions in http://fedoraproject.org/wiki/Systemd [mysqld_safe] #log-error=/var/log/mariadb/mariadb.log #pid-file=/var/run/mariadb/mariadb.pid # # include all files from the config directory # #!includedir /etc/my.cnf.d
cp support-files/mysql.server /etc/init.d/mysqld
编辑/etc/init.d/mysqld将文件中的下面两行改成咱们以前定义好的目录。basedir=/usr/local/mysql datadir=/data/mysql
chkconfig --add mysqld
[root@localhost mysql]# chkconfig --list 注意:该输出结果只显示 SysV 服务,并不包含原生 systemd 服务。SysV 配置数据可能被原生 systemd 配置覆盖。 若是您想列出 systemd 服务,请执行 'systemctl list-unit-files'。 欲查看对特定 target 启用的服务请执行 'systemctl list-dependencies [target]'。 iprdump 0:关 1:关 2:开 3:开 4:开 5:开 6:关 iprinit 0:关 1:关 2:开 3:开 4:开 5:开 6:关 iprupdate 0:关 1:关 2:开 3:开 4:开 5:开 6:关 netconsole 0:关 1:关 2:关 3:关 4:关 5:关 6:关 network 0:关 1:关 2:开 3:开 4:开 5:开 6:关 [root@localhost mysql]# chkconfig --add mysqld [root@localhost mysql]# chkconfig --list 注意:该输出结果只显示 SysV 服务,并不包含原生 systemd 服务。SysV 配置数据可能被原生 systemd 配置覆盖。 若是您想列出 systemd 服务,请执行 'systemctl list-unit-files'。 欲查看对特定 target 启用的服务请执行 'systemctl list-dependencies [target]'。 iprdump 0:关 1:关 2:开 3:开 4:开 5:开 6:关 iprinit 0:关 1:关 2:开 3:开 4:开 5:开 6:关 iprupdate 0:关 1:关 2:开 3:开 4:开 5:开 6:关 mysqld 0:关 1:关 2:开 3:开 4:开 5:开 6:关 netconsole 0:关 1:关 2:关 3:关 4:关 5:关 6:关 network 0:关 1:关 2:开 3:开 4:开 5:开 6:关
[root@localhost ~]# service mysqld start Starting MySQL.Logging to '/data/mysql/localhost.localdomain.err'. .. SUCCESS! [root@localhost ~]# !ps ps aux |grep mysql root 3039 0.0 0.0 11820 1620 pts/0 S 23:45 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/localhost.localdomain.pid mysql 3177 10.1 11.7 1303228 453104 pts/0 Sl 23:45 0:02 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=localhost.localdomain.err --pid-file=/data/mysql/localhost.localdomain.pid --socket=/tmp/mysql.sock root 3205 0.0 0.0 112724 968 pts/0 R+ 23:46 0:00 grep --color=auto mysql