1.1 MySQL安装介绍

mysql软件下载地址信息: www.mysql.com   mirrors.sohu.com

mysql软件下载完毕后,查看mysql解压后目录文件大小

1.下载解压mysql二进制软件包

链接:https://pan.baidu.com/s/145F-0VyaQ9C_-Xy8kNZLug 密码:cojx

下载解压MySQL二进制软件包

tar xf mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz

2.MySQL程序运行时的管理用户

useradd -s /sbin./nologin -M mysql
id mysql
[root@web01 ~]# id mysql
uid=501(mysql) gid=501(mysql) groups=501(mysql)

3.mysql解压后的程序包搬家到程序目录下,并进行重命名

useradd -s /sbin./nologin -M mysql
id mysql
[root@web01 ~]# id mysql
uid=501(mysql) gid=501(mysql) groups=501(mysql)

4.为mysql服务程序创建软链接

ln -s /application/mmysql-5.6.34/ /application/mysql
[root@web01 tools]# ln -s /application/mysql-5.6.34/ /application/mysql
[root@web01 tools]# ll /application/mmysql
lrwxrwxrwx 1 root root 27 May 22 23:39 /application/mysql -> /application/mysql-5.6.34/

5.让mysql用户管理 /application/mysql/

chown -R mysql.mysql /application/mysql/
[root@web01 application]# ll
total 4
lrwxrwxrwx 1 root root 13 May 22 23:46 mysql -> mysql-5.6.34/
drwxr-xr-x 13 mysql mysql 4096 May 22 23:46 mysql-5.6.34

  

6.初始化数据库

#1. 确认软件安装在哪里

#2. 确认数据存放在哪里

#3. 确认MySQL使用的用户谁?

/application/mysql/scripts/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data --user=mysql
[root@web01 application]# /application/mysql/scripts/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data --user=mysql
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
mysql启动脚本 默认放在support-files/mysql.server 记得给MySQL设置个密码
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/application/mysql/bin/mysqladmin -u root password 'oldboy123'
/application/mysql/bin/mysqladmin -u root -h web01 password 'new-password'
mysql5.7
cd /application/mysql/
./bin/mysqld --initialize --user=mysql --basedir=/application//mysql --datadir=/application/mysql/data

7.复制启动脚本 授权

cp /application/mysql/support-files/mysql.server  /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
默认启动脚本放在的位置
加执行权限 

8.修改启动脚本 和 mysql命令中的路径

 sed -i 's#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe /etc/init.d/mysqld

9. 复制默认的配置文件

   \cp /application/mysql/support-files/my-default.cnf  /etc/my.cnf 

/etc/init.d/mysqld start
至此,mysql数据库安装与启动完成;可以检测进程和服务端口,确认mysql服务是否启动正确 [root@web01 application]# netstat -lntup |grep mysql
tcp 0 0 :::3306 :::* LISTEN 7725/mysqld

扩展:讲解管理mysql数据库

10.进入与退出mysql数据库方法:

/application/mysql/bin/mysql
扩展知识:登录数据库命令简化方法
echo 'export PATH=/application/mysql/bin:$PATH' >>/etc/profile
source /etc/profile
which mysql
退出数据库时,尽量不要用ctrl+c进行退出mysql 用ctrl+d进行退出
[root@web01 application]# echo $PATH
/application/mysql/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

11.设置mysql服务开机自启动

####11.加入开机自启动
chkconfig --add mysqld
chkconfig mysqld on

12.设置mysql数据库登录用户名与密码

SET PASSWORD FOR 'root'@localhost=PASSWORD('Your Password');

####12.给MySQL root用户设置密码
/application/mysql/bin/mysqladmin -u root password '123456'
mysql -uroot -p123456 [root@web01 application]# mysql -uroot -p123456
Warning: Using a password on the command line interface can be insecure.
[root@web01 application]# mysql -uroot -p123456
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.34 MySQL Community Server (GPL) Copyright (c) 2000, 2016, 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的更多相关文章

  1. 二进制安装MySQL数据库

    今天安装的是二进制的mysql包5.7.21的包,在配置文件的时候采了好多坑,左后还是搞定了,来和大家分享一下 二进制msyql5.7.21版本的主从复制安装 新建/picclife目录 mkdir  ...

  2. CentOS 6.5下二进制安装 MySQL 5.6

    CentOS 6.5 二进制安装MySQL 5.6 1:查看系统版本 [root@10-4-5-9 mysql]# cat /etc/redhat-release CentOS release 6.5 ...

  3. 二进制安装MySQL及破解密码

    二进制安装MySQL及破解密码 1.确保系统中有依赖的libaio 软件,如果没有: yum -y install libaio 2.解压二进制MySQL软件包 tar xf mysql-5.7.24 ...

  4. ubuntu14.04下简易二进制安装mysql

    下载mysql-commnunity的5.6.24通用二进制版 tar解压 我安装到/opt目录,所以mv到/opt/ 可选,建了个软链 ln -s *** mysql 添加运行mysql服务的用户和 ...

  5. 编译安装和二进制安装mysql

    二进制安装mysql-5.6.46 mysql二进制安装,已经编译成二进制了,只需要做一些配置即可 [root@localhost ~]$ yum install autoconf libaio -y ...

  6. shell 脚本二进制安装mysql

    以下脚本的手动安装连接:https://www.cnblogs.com/leihongnu/p/12581793.html [ #/bin/bash#脚本安装 mysql,上传安装包至 /rootcd ...

  7. 二进制安装Mysql 5.6(免编译)

    安装系统基础软包 yum install -y make bc perl gcc openssl openssl-devel ncurses ncurses-devel 安装方式:二进制免编译安装 查 ...

  8. centos7 使用二进制安装mysql 5.7.23

    1.下载二进制安装包 mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz cd /usr/local/src wget https://cdn.mysql.com// ...

  9. CentOS 6.2下二进制安装 MySQL 5.6

    在CentOS 6.2上 二进制方式安装 MySQL5.6二进制包 可以参考这篇文章: http://www.cnblogs.com/xiaoit/p/3988640.html 一路配置下来很顺利.. ...

随机推荐

  1. Std::map too few template arguments

    在上述的代码中,红色波浪线的部分编译的时候报错: error C2976: 'std::map' : too few template arguments 换成std::map<std::str ...

  2. Android性能优化-减小图片下载大小

    原文链接 https://developer.android.com/topic/performance/network-xfer.html 内容概要 理解图片的格式 PNG JPG WebP 如何选 ...

  3. ASP.NET Core入门系列教程

    微软把这个新的框架叫:Razor Pages,以下文中我们将频繁提及—Razor Pages. 项目目录结构 wwwroot静态资源文件夹首先,Razor Pages项目中多了一个wwwroot的文件 ...

  4. [Python设计模式] 第11章 迪米特法则——最少知识原则

    github地址:https://github.com/cheesezh/python_design_patterns 迪米特法则 迪米特法则(LoD),也叫最少知识原则,如果两个类不必彼此直接通信, ...

  5. 【LeetCode】238. Product of Array Except Self

    Product of Array Except Self Given an array of n integers where n > 1, nums, return an array outp ...

  6. ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired

    开发说测试环境在删除表的时候,报了如下错误: SQL> drop table tke purge; drop table tke purge * ERROR at line 1: ORA-000 ...

  7. ARM与X86 CPU架构对比区别

    CISC(复杂指令集计算机)和RISC(精简指令集计算机)是当前CPU的两种架构.它们的区别在于不同的CPU设计理念和方法.早期的CPU全部是CISC架构,它的设计目的是  CISC要用最少的机器语言 ...

  8. 《ZooKeeper分布式专题与Dubbo微服务入门》

    最近在慕课网新上的课程,有兴趣的朋友可以关注一波 http://coding.imooc.com/class/201.html

  9. 前台报错:Uncaught TypeError: Cannot read property '0' of null

    错误现象: var div1=mycss[0].style.backgroundColor;  //这一行提示360和chrome提示:Uncaught TypeError: Cannot read  ...

  10. JS原生实现视频弹幕Demo(仿)

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http ...