centos7 php开发环境安装-mysql

MySQL安装

1.安装cmake(作为mysql的安装工具)

tar -zxvf cmake-3.8.0.tar.gz

cd cmake-3.8.0

./bootstrap

gmake

gmake install

2.安装boost_1_59_0

tar -zxvf boost_1_59_0.tar.gz

cd boost_1_59_0

./bootstrap.sh

./b2

./b2 install

3.创建用户、配置目录

添加mysql用户和所属组

/usr/sbin/groupadd mysql

/usr/sbin/useradd  -g mysql mysql

创建mysql安装目录和数据目录

mkdir /usr/local/mysql

mkdir /usr/local/mysql/data

修改mysql目录所有者

chown -R mysql:mysql /usr/local/mysql

4.安装mysql

tar -zxvf mysql-5.7.14.tar.gz

cd mysql-5.7.14

以下复制到文本中

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data  -DDOWNLOAD_BOOST=1  -DWITH_BOOST=/usr/local/src/boost_1_59_0 -DMYSQL_UNIX_ADDR=/usr/local/mysql/tmp/mysql.sock  -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DENABLED_LOCAL_INFILE=ON -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1  -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1  -DWITHOUT_PARTITION_STORAGE_ENGINE=1  -DWITH_FAST_MUTEXES=1  -DWITH_ZLIB=bundled -DENABLED_LOCAL_INFILE=1  -DWITH_READLINE=1  -DWITH_EMBEDDED_SERVER=1 -DWITH_DEBUG=0

make

make install

5.mysql安装失败重新编译时,需要清除旧的对象文件和缓存信息

make clean

rm -f CMakeCache.txt

rm -rf /etc/my.cnf

6.配置mysql并初始化数据库

配置文件:

cp /usr/local/mysql/support-files/my-default.cnf  /etc/my.cnf

初始化数据库:

./mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

启动mysql数据库

/usr/local/mysql/bin/mysqld_safe -defaults-file=/etc/my.cnf -basedir=/usr/local/mysql  --datadir=/usr/local/mysql/data -user=mysql & ./--mysqld_safe --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql &

查看是否启动

ps -ef | grep mysqld

建立软链接:

ln -s /usr/local/mysql/bin/mysql    /usr/bin

7.修改初始化密码

mysql  -u root  -p

Set password = password(‘xxx‘);

Alter user ‘root‘@‘localhost‘ password expire never;

grant all privileges on *.* to [email protected]‘%‘ identified by ‘xxx‘;

grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘xxx‘ with grant option;

Flush privileges;

8.开机启动

  1. touch /usr/lib/systemd/system/mysql.service

2.设置内容

[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf
LimitNOFILE = 5000
#Restart=on-failure
#RestartPreventExitStatus=1
#PrivateTmp=false

9.操作

systemctl start mysql

systemctl stop mysql

systemctl restart mysql

systemctl disable mysql

systemctl enable mysql

systemctl status mysql

  

原文地址:https://www.cnblogs.com/ddf128/p/12123837.html

时间: 2024-10-19 11:12:57

centos7 php开发环境安装-mysql的相关文章

Centos7 开发环境安装mysql社区版本

1,Centos7安装 mysql 首先开发的服务器是centos7,上面默认安装的数据库是MariaDB. 还是有一点区别的.要安装mysql而且oracle提供的还是个社区版本. 无所谓,开发而已,装上就行. http://dbahire.com/how-to-install-mysql-5-6-on-centos-7/ yum install http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm yum inst

centos7 php开发环境安装-Git

Git 的2中安装方法 1. yum命令安装: yum install -y git 2. 服务编译安装(推荐) 2.1 安装依赖包 yum install -y wget yum install -y gcc-c++ yum install -y zlib-devel perl-ExtUtils-MakeMaker 2.2 下载最新git cd /usr/local/src wget https://mirrors.edge.kernel.org/pub/software/scm/git/gi

centos7 php开发环境安装-php

PHP7.2 安装 1.创建运行用户 groupadd www useradd -g www www 2.建立软连接 cp -frp /usr/lib64/libldap* /usr/lib/ ln -s /usr/local/lib/libiconv.so.2 /usr/lib64/ 3.编译安装php tar -zxvf php-7.2.4.tar.gz cd php-7.2.4 ./configure --prefix=/usr/local/php --with-config-file-p

CentOS7/64位环境安装Mysql 5.7.19二进制包教程

1.下载mysql 在官网:http://dev.mysql.com/downloads/mysql/ 中,选择二进制的mysql版本下载: #wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz 2.解压 #tar -xzvf mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz  --解压 #mv mysql-5.7.18-lin

centos7 php开发环境安装-Nginx

1.Nginx编译安装 tar -zxvf nginx-1.12.2.tar.gz cd nginx-1.12.2 ./configure --user=www --group=www --prefix=/usr/local/nginx/ --with-http_v2_module --with-http_ssl_module --with-http_sub_module --with-http_stub_status_module --with-http_gzip_static_module

centos7 php开发环境安装-composer

1.安装composer cd /usr/local/src curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer 2.Composer 使用 chmod -R 777 /usr/local/bin/composer (错误时修改权限) 3.切换国内镜像 composer config -g repo.packagist composer https://packagis

centos7 php开发环境安装--配置SSL(Apache为例)

1.检查是否安装OpenSSL 1.1 查看是否安装 openssl version 1.2 编译安装: https://www.cnblogs.com/rxbook/p/9367725.html 1.3  yum安装 yum install openssl yum install openssl-devel 1.4 在线升级 yum -y update openssl 2.配置证书上传目录 在Apache安装目录中新建cert目录,并将下载的Apache证书. 证书链文件和秘钥文件拷贝到cer

centos7 php开发环境安装(一)

准备工作 防火墙 systemctl status firewalld        看到active(running)就意味着防火墙打开了 systemctl stop firewalld          看到inactive(dead)就意味着防火墙关闭了 systemctl start firewalld          打开防火墙 systemctl disable firewalld        重启后防火墙还是处于关闭的状态 systemctl enable firewalld

三、安装cmake,安装resin ,tars服务,mysql 安装介绍,安装jdk,安装maven,c++ 开发环境安装

三.安装cmake,安装resin 2018年07月01日 21:32:05 youz1976 阅读数:308 开发环境说明: centos7.2 ,最低配置:1核cpu,2G内存,1M带宽 1.安装rz,sz命令,将安装包发送至服务器 yum install lrzsz 2.glibc-devel安装介绍如果没有安装glibc的开发库,需要先安装. yum install glibc-devel 3.安装gcc yum install gccyum install gcc-c++ 4.cmak