天门网站,做品牌网站的,百度搜索引擎seo,编程培训机构加盟哪家好博主邮箱www.zzherfoxmail.com qq#xff1a;11024719111 //获得以下所需的源代码包(文末附有安装包)#xff0c;并存放在/usr/local/src2 //与mysql相关#xff1a;3 boost_1_59_0.tar.gz cmake-3.6.2.tar.gz mysql-5.7.16.tar.gz45 //安装cmake前的依赖包的安装6 //检查gc…博主邮箱www.zzherfoxmail.com qq11024719111 //获得以下所需的源代码包(文末附有安装包)并存放在/usr/local/src2 //与mysql相关3 boost_1_59_0.tar.gz cmake-3.6.2.tar.gz mysql-5.7.16.tar.gz45 //安装cmake前的依赖包的安装6 //检查gcc-c 、ncurses-devel是否安装如果没有安装先用yum进行安装78 编译安装cmake工具9 cd /usr/local/src10 tar xf cmake-3.6.2.tar.gz11 cd cmake-3.6.212 ./bootstrap --prefix/usr/local/cmake13 make14 make install #如果前面没有指定安装目录则默认安装到/usr/local/bin/cmake1516 建立mysql组和用户并将mysql用户添加到mysql组17 groupadd mysql18 useradd -g mysql mysql19 创建mysql数据文件存放的目录20 mkdir /mydata21 chown mysql:mysql /mydata22 chmod o /mydata #设置其他人没有任何权限2324 编译安装mysql25 cd /usr/local/src26 tar xf mysql-5.7.16.tar.gz27 cd mysql-5.7.1628 /usr/local/cmake/bin/cmake . -DCMAKE_INSTALL_PREFIX/usr/local/mysql -DMYSQL_DATADIR/mydata -DWITH_BOOST/usr/local/src -DSYSCONFDIR/etc -DWITH_BLACKHOLE_STORAGE_ENGINE1 -DWITH_READLINE1 -DWITH_PARTITION_STORAGE_ENGINE1 -DEXTRA_CHARSETSall -DDEFAULT_CHARSETutf8 -DDEFAULT_COLLATIONutf8_general_ci -DWITH_DEBUG0 -DMYSQL_MAINTAINER_MODE0 -DWITH_SSL:STRINGbundled -DWITH_ZLIB:STRINGbundled29 make make install3031 更改mysql安装目录的属主属组并添加mysql环境变量32 chown -R mysql:mysql /usr/local/mysql33 vim /etc/profile.d/mysql.sh34 文件内容是35 export PATH$PATH:/usr/local/mysql/bin36 执行命令37 bash #让新的PATH变量生效3839 加入服务列表并设置为开机自启40 cd /usr/local/mysql/support-files41 cp mysql.server /etc/init.d/mysqld42 chmod x /etc/init.d/mysqld43 chkconfig mysqld on4445 修改mysql的配置文件46 cat /etc/my.cnf4748 [mysql]49 socket/tmp/mysql.sock5051 [mysqld]52 datadir/mydata53 socket/tmp/mysql.sock54 usermysql55 symbolic-links05657 [mysqld_safe]58 log-error/var/log/mysqld.log59 pid-file/mydata/mysqld.pid6061 初始化mysql62 mysqld --initialize-insecure --usermysql --basedir/usr/local/mysql --datadir/mydata63 说明64 ##“-–initialize”会生成一个随机密码(~/.mysql_secret)而”–initialize-insecure”不会生成密码 ##user表示指定用户 ##basedir表示mysql的安装路径datadir表示数据库文件存放路径6566 启动mysql服务67 # service mysqld start68 查看MySQL服务的进程和端口69 # ps -ef |grep mysqld70 root 22306 1 0 12:51 pts/0 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir/mydata --pid-file/mydata/web1.deng.com.pid71 mysql 22480 22306 12 12:51 pts/0 00:00:00 /usr/local/mysql/bin/mysqld --basedir/usr/local/mysql --datadir/mydata --plugin-dir/usr/local/mysql/lib/plugin --usermysql --log-error/var/log/mysqld.log --pid-file/mydata/web1.deng.com.pid --socket/tmp/mysql.sock7273 # netstat -an | grep :330674 tcp 0 0 :::3306 :::*LISTEN7576 初始化MySQL数据库的root用户密码77 # mysql_secure_installation7879 Securing the MySQL server deployment.8081 Connecting to MySQL using a blank password.8283 VALIDATE PASSWORD PLUGIN can be used to test passwords84 and improve security. It checks the strength of password85 and allows the users to set only those passwords which are86 secure enough. Would you like to setup VALIDATE PASSWORD plugin?8788 Press y|Y for Yes, any other key forNo: y #需要修改密码所以输入y8990 There are three levels of password validation policy:9192 LOW Length 893 MEDIUM Length 8, numeric, mixed case, and special characters94 STRONG Length 8, numeric, mixed case, special characters and dictionary file9596 Please enter 0 LOW, 1 MEDIUM and 2 STRONG: 2#设置密码复杂度为强97 Please set the password forroot here.9899 New password:100101 Re-enter newpassword: #输入2次新密码102103 Estimated strength of the password: 100104 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key forNo) : y105 By default, a MySQL installation has an anonymous user,106 allowing anyone to log into MySQL without having to have107 a user account created for them. This is intended only for108 testing, and to make the installation go a bit smoother.109 You should remove them before moving into a production110 environment.111112 Remove anonymous users? (Press y|Y for Yes, any other key forNo) : y #删除匿名用户113 Success.114115116 Normally, root should only be allowed to connect from117 localhost. This ensures that someone cannot guess at118 the root password from the network.119120 Disallow root login remotely? (Press y|Y for Yes, any other key forNo) : y #禁止root远程登录121122 ... skipping.123 By default, MySQL comes with a database named testthat124 anyone can access. This is also intended only fortesting,125 and should be removed before moving into a production126 environment.127128129 Remove test database and access to it? (Press y|Y for Yes, any other key forNo) : y #删除测试数据库130 -Dropping test database...131 Success.132133 -Removing privileges on test database...134 Success.135136 Reloading the privilege tables will ensure that all changes137 made so far will take effect immediately.138139 Reload privilege tables now? (Press y|Y for Yes, any other key forNo) : y #重新加载权限表140 Success.141142 All done!143144 将MySQL数据库的动态链接库共享至系统链接库145 vim /etc/ld.so.conf.d/mysql.conf146 文件内容是147 /usr/local/mysql/lib148149 ldconfig -v 让系统重新读取库文件150151 测试登陆MySQL数据库152 # mysql -uroot -p153 Enter password: #输入刚才设置的新密码154 Welcome to the MySQL monitor. Commands end with; or \g.155 Your MySQL connection id is 5156 Server version: 5.7.14Source distribution157158 Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.159160 Oracle is a registered trademark of Oracle Corporation and/or its161 affiliates. Other names may be trademarks of their respective162 owners.163164 Type help; or \h for help. Type \cto clear the current input statement.165166 mysqlshow databases;167 --------------------168 | Database |169 --------------------170 | information_schema |171 | mysql |172 | performance_schema |173 | sys |174 --------------------175 4 rows in set (0.00sec)176177 mysqlexit178 Bye