标签:tor utf8 ssl soc 缺点 engine extra ble distrib
首先MySQL是关系型数据库,什么是关系型关系型数据库,优缺点我们也讲了,在上一篇博客:https://blog.51cto.com/14573101/2447264现在我们来说一说,MySQL的安装方式有哪几种:
1.RPM|yum安装速度快,安装方便,不能定制
2.二进制:无须安装,解压即用,不能定制
3.编译安装:安装慢,可定制
5.5之前: ./configure make make install
5.5之后:cmake gmake
4.先编译,然后制作rpm,制作yum库,接着yum安装
简便、速度快、可定制、稍微复杂、制作时间长
这里我们选择3.编译安装,先准备好安装包,这里我们用的是MySQL5.6.36
点击官方下载mysql-5.6.36.tar.gz
百度云盘下载官网MySQL-5.6.36:提取码:r46x
1.安装依赖包和cmake:yum install -y ncurses-devel libaio-devel cmake
2.创建mysql用户useradd -s /sbin/nologin -M mysql
检查用户:id mysql
3.把下载好的安装包上传到系统里的软件存放目录
4.解压tar xf mysql-5.6.36
5.进入解压后的目录 cd mysql-5.6.36
6.开始安装;
cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.6.36 -DMYSQL_DATADIR=/application/mysql-5.6.36/data -DMYSQL_UNIX_ADDR=/application/mysql-5.6.36/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 -DWITH_ZLIB=bundled -DWITH_SSL=bundled -DENABLED_LOCAL_INFILE=1 -DWITH_EMBEDDED_SERVER=1 -DENABLE_DOWNLOADS=1 -DWITH_DEBUG=0
make && make install
以上都是我们自己定义的元数据,可通用
至此编译完成开始优化配置
7.制作mysql目录的软连接(制作软连接的作用:方便升级,优化命令等)ln -s /application/mysql-5.6.36/ /application/mysql
8.拷贝配置文件
\cp support-files/my*.cnf /etc/my.cnf
9.初始化数据库/application/mysql/scripts/mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data --user=mysql
10.创建tmp目录(因为上面我们定义了sock文件在这里)mkdir -p /application/mysql/tmp
11.为mysql文件夹设置权限,避免权限不足及其他问题chown -R mysql.mysql /application/mysql/
12.设置启动脚本\cp -a support-files/mysql.server /etc/init.d/mysqld
13.可以启动mysql了!
/etc/init.d/mysqld start
检查是否启动
netstat -lntup|grep 3306
ps -ef|grep mysql
lsof -i:3306
14.配置环境变量
echo ‘PATH=/application/mysql/bin/:$PATH‘ >>/etc/profile
tail -1 /etc/profile
source /etc/profile
在命令行输入mysql即可进入,默认空密码
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.36 Source distribution
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
mysql>
注意!每一步都不能少,尤其是下载依赖和初始化数据库,如果有报错可以查看日志或者重新执行步骤排错!
如有问题请留言联系博主,希望此篇文章能帮助你走向人生巅峰,迎娶白富美!
恭喜你,配置好MySQL!
标签:tor utf8 ssl soc 缺点 engine extra ble distrib
原文地址:https://blog.51cto.com/14573101/2447395