博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
二进制格式安装MySQL
阅读量:6847 次
发布时间:2019-06-26

本文共 3986 字,大约阅读时间需要 13 分钟。

什么是通用二进制格式?

已经编译进行过编译的软件包,下载到本机直接解压到特定的目录下就可以使用的格式.1.查询本地是否安装mysql数据库相关的软件包(卸载之)rpm -qa "mysql*"   (centos6)rpm -qa "mariaDB*" (cetos7)2.mariadb.org下载源码二进制包带有linux字样的已经编译过的包:mariadb-10.2.12-linux-x86_64.tar.gz(大小440M左右因为已经编译过)3. 准备用户getent passwd mysql  查询passwd是否有mysql用户useradd -r mysql -s /sbin/nologin  创建mysql系统用户[root@centos7 ~ 13]#id mysqluid=990(mysql) gid=305(mysql) groups=305(mysql)生产环境建议置后一个版本至少.4.解压mariadb-10.2.12-linux-x86_64.tar.gz4-1. tar xvf  mariadb-10.2.12-linux-x86_64.tar.gz -C /usr/local/注意:解压目录指定,因为这是已经编译过的源码包所以路径很重要需要解压到/usr/local/下4-2.需要改名因为编译之前的目录叫mysql;建议创建软连接:ln -s mariadb-10.2.12-linux-x86_64/ mysql5.修改文件权限默认没有属主属组:(可以不做修改)chown -R mysql.mysql mysql/6.导出环境变量:echo 'PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysql.shcat /etc/profile.d/mysql.sh. /etc/profile.d/mysql.sh (重读配置文件)7.准备数据目录;建议使用逻辑卷7-1.创建逻辑卷:fdiak /dev/sda7-2.同步磁盘:partprobe (6 使用pertx)7-3.创建PV物理卷:pvcreate /dev/sda67-4. 创建卷组:vgcreate vg0-mysqldata /dev/sda6 -s 16M7-5.查看卷组:vgdisplay7-6.创建LVMlvcreate -n lv_mysqldata -l 100%FREE vg0mysqldata7-7.创建逻辑卷的文件系统:mkfs.xfs /dev/vg0mysqldata/lv_mysqldata8.创建挂载点并且挂载添加/etc/fstab条目(请注意当前所在的工作目录.我当前的路径是在/usr/local/mysql/bin)mkdir -pv /data/mysqldbecho ' UUID=98833275-08ee-446f-b888-3e03557deedf /data/mysqldb xfs defaults 0  0' >> /etc/fstab (建议别这么添加清空了这个文件就尴尬了)mount -a 重读/etc/fsatb9.这连个就是mysql的数据库目录了安全起见建议修改权限为770chmod 770 /data/mysqldb/10.初始化数据库:cd scripts/scripts/mysql_install_db --datadir=/data/mysqldb --user=mysql注意:这个脚本一定要在它的上一级目录执行否则会报错11.由于默认的配置文件过于简陋而且数据库路径也不对,可参考/usr/local/mysql/support-files/目录下以.cnf结尾的模版配置文件.11-1.cp my-huge.cnf /etc/my.cnf (覆盖目标文件)修改如下:12.运行/usr/local/mysql/mysql-server 服务脚本cp mysql.server /etc/init.d/mysqld 复制并改名mysqldchkconfig --add mysqld   添加到系统脚本开机启动13.启动服务:service mysqld start源码安装结束14.查看是否有错误信息15.查看端口3306ss -tnl16.mysql安装完成默认没有密码需要运行一个安全脚本:. /mysql_secure_installation (交互式设置密码及删除匿名用户)[root@centos7 /usr/local/mysql/bin 178]# ./mysql_secure_installationNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB     SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!In order to log into MariaDB to secure it, we'll need the currentpassword for the root user.  If you've just installed MariaDB, andyou haven't set the root password yet, the password will be blank,so you should just press enter here.Enter current password for root (enter for none): 输入root旧口令(没有直接回车)OK, successfully used password, moving on...Setting the root password ensures that nobody can log into the MariaDBroot user without the proper authorisation.Set root password? [Y/n] y  是否设置root口令New password: 密码Re-enter new password: 确认密码Password updated successfully!Reloading privilege tables..... Success!By default, a MariaDB installation has an anonymous user, allowing anyoneto log into MariaDB without having to have a user account created forthem.  This is intended only for testing, and to make the installationgo a bit smoother.  You should remove them before moving into aproduction environment.Remove anonymous users? [Y/n] y  删除匿名用户... Success!Normally, root should only be allowed to connect from 'localhost'.  Thisensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y/n] n    是否禁用root远程等... skipping.By default, MariaDB comes with a database named 'test' that anyone canaccess.  This is also intended only for testing, and should be removedbefore moving into a production environment.Remove test database and access to it? [Y/n] y  是否删除test测试数据库(随机附带的测试数据库)- Dropping test database...... Success!- Removing privileges on test database...... Success!Reloading the privilege tables will ensure that all changes made so farwill take effect immediately.Reload privilege tables now? [Y/n] y 是否重新加载并且生效... Success!Cleaning up...All done!  If you've completed all of the above steps, your MariaDBinstallation should now be secure.Thanks for using MariaDB!启动服务:service mysqld start本地安装mysql的Mysql-client 命令行测试连接

转载于:https://blog.51cto.com/37003839/2088120

你可能感兴趣的文章
HTTPClient模拟登陆21CN
查看>>
(转) Twisted :第六部分 抽象地利用Twisted
查看>>
php+mysql+html页面编码解决方案
查看>>
moinmoin 1.9.7 成功移机记录
查看>>
毕业设计总目录
查看>>
121 项目 031 笔记向 jquery validation
查看>>
hive 脚本
查看>>
三栏布局
查看>>
Golang 用指定网卡的IP发送HTTP请求
查看>>
java表达式引擎
查看>>
写脚本时的一些心得
查看>>
微信开发,网页扫码登录和公众号授权登录
查看>>
mysql给root开启远程访问权限,修改root密码
查看>>
网站安全狗IIS版 V4.0.15586 发布
查看>>
Docker存储驱动之AUFS简介
查看>>
Java中如何封装自己的类,建立并使用自己的类库?
查看>>
Java Http请求工具类
查看>>
iscsi集群搭建
查看>>
Spring IOC FactoryBean检测与获取Bean
查看>>
Server certificate verification failed: certificate issued for a different hostn
查看>>