MySQL基础部分

mysql安装脚本

安装前请将相关安装包copy放到/server/tools目录下

-rw-r--r-- 1 root root 314149697 Mar 23  2017 mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz

执行安装脚本:

 #!/bin/bash
#install MySQL
#新增用户
useradd -M -s /sbin/nologin mysql
#进入软件目录
cd /server/tools
#解压
tar xf mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz
#移动目录并创建软连接
mv mysql-5.6.34-linux-glibc2.5-x86_64 /application/mysql-5.6.34
ln -s /application/mysql-5.6.34/ /application/mysql
#授权
chown -R mysql.mysql /application/mysql/data/
#初始化程序
/application/mysql/scripts/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data --user=mysql
#配置启动脚本进行授权
cp /application/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
sed -i 's#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe /etc/init.d/mysqld
\cp /application/mysql/support-files/my-default.cnf /etc/my.cnf #优化:将命令增加到环境变量
echo 'export PATH=/application/mysql/bin:$PATH' >>/etc/profile
source /etc/profile #加入开机自启动
chkconfig --add mysqld
chkconfig mysqld on
#启动服务
/etc/init.d/mysqld start

安装完后执行ps-ef | grep mysql查看

[root@web01 tools]# ps -ef | grep mysql
root 10937 1 0 19:53 pts/2 00:00:00 /bin/sh /application/mysql/bin/mysqld_safe --datadir=/application/mysql/data --pid-file=/application/mysql/data/web01.pid
mysql 11053 10937 0 19:53 pts/2 00:00:01 /application/mysql/bin/mysqld --basedir=/application/mysql --datadir=/application/mysql/data --plugin-dir=/application/mysql/lib/plugin --user=mysql --log-error=/application/mysql/data/web01.err --pid-file=/application/mysql/data/web01.pid
root 11162 10821 0 20:19 pts/2 00:00:00 grep mysql

给mysql用户设置密码

[root@web01 ~]# mysqladmin -u root password 'oldboy123'   --设置root密码为oldboy123
Warning: Using a password on the command line interface can be insecure.
[root@web01 ~]# mysql -uroot -poldboy123        --登录root用户
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 6
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> quit      --退出
Bye

Linux 期中架构 MySQL的更多相关文章

  1. Linux 期中架构 Ansible

    ansible  自动化软件   基于Python开发 特点概述: 配置文件不需要过多配置  了解就可以了 ###部署ansble软件 ##受控主机部署 backup   nfs01   web01 ...

  2. Linux 期中架构 PHP

    环境 PHP安装前准备  先将需要的软件包如下位置放置.另外需要有WWW用户   参照nginx 满足以上条件后执行安装脚本 PHP安装脚本: #!/bin/bash #install PHP #au ...

  3. Linux 期中架构 inotify

    全网备份数据同步方案 备份网站内部人员信息  不能解决外部(人员)上传数据的备份 定时任务最短执行的周期为一分钟,采用定时任务方式,有时可能造成一分钟内的数据丢失 因此对于重要数据需要采用实时同步的方 ...

  4. Linux 期中架构 rsync

    上篇 Rsync rysnc查看版本   --version 全量  与增量在效率上有区别 cp mv scp  --全量复制 rsync       --增量复制 rsync利用的是quick ch ...

  5. Linux期中架构

    1    在构建完模板后  开启虚拟机后 需要再重启一次  以解决网卡不能看见的问题 ########################################add begin 2018-05 ...

  6. Linux 期中架构 SSH

    为其他网络服务提供安全协议.替代Telnet SSH:   实现数据加密传输 22  默认支持root用户远程连接 类似sftp-server服务 nmap -p 22 10.0.0.41 nc 10 ...

  7. Linux期中架构 全网备份案例

    server端脚本 #!/bin/bash #1 进行数据完整性验证 并生成结果 find /backup -type f -name "finger.txt"| xargs md ...

  8. linux 期中架构之 nginx 安装与排错

    1, 安装 nginx 所需要的pcre库 即:perl 兼容正则表达式 yum install pcre pcre-devel -y rpm -qa pcre pcre-devel 检查是否安装好p ...

  9. Linux运维就业技术指导(八):期中架构考核

    一,期中架构考核概述 1.1 架构图 1.2 架构图公司背景概述 公司是一个新兴的人脸识别高新创业公司,公司名称xxxx 老总是博士生导师,还有一个副总是研究生导师 副总同时是研发总监,负责所有的研发 ...

随机推荐

  1. SystemInfo获取计算机相关信息

    // SystemInfo.cpp : 定义控制台应用程序的入口点.// #include "stdafx.h"#include <iostream>#include ...

  2. 玩转X-CTR100 l STM32F4 l OLED显示-SSD1306无字库

    我造轮子,你造车,创客一起造起来!塔克创新资讯[塔克社区 www.xtark.cn ][塔克博客 www.cnblogs.com/xtark/ ]      OLED显示屏具有自发光特性,不需要背光, ...

  3. 解决Android4.3版本下,手机短彩接收中文文件名附件,中文名字的附件无法保存(第二步:解决从从数据库中读取附件文件名,并在长按后保存附件时,中文乱码导致的无法保存附件)

    从第一步我们发现,在第一步修改之后,在短彩绘画界面中中文附件名的附件已无法显示,经过打印堆栈我们发现还是中文乱码在作祟.下面我们接着进行分析,这次我们从UI层往逻辑处理层进行分析.首先我们找到保存附件 ...

  4. tomcat部署和启动3

    点击STATUES,弹出登陆框 You are not authorized to view this page. If you have not changed any configuration ...

  5. HslControls组件库 工业控件库 曲线控件 时间控件 管道控件 温度计控件 阀门控件 传送带控件 进度条控件 电池控件 数码管控件等等

    本篇博客主要对 HslControls 组件做一个大概的总览介绍,更详细的内容可以参照页面里的子链接,还有github上的源代码,然后进行相关的学习,和使用. Prepare 先从nuget下载到组件 ...

  6. OK335xS CAN device register and deiver match hacking

    /************************************************************************* * OK335xS CAN device regi ...

  7. 【OpenCV】Learn OpenCV

    learn opencv website: https://www.learnopencv.com/ learn opencv github:https://github.com/spmallick/ ...

  8. LG2521 [HAOI2011]防线修建

    题意 题目描述 近来A国和B国的矛盾激化,为了预防不测,A国准备修建一条长长的防线,当然修建防线的话,肯定要把需要保护的城市修在防线内部了.可是A国上层现在还犹豫不决,到底该把哪些城市作为保护对象呢? ...

  9. 剑指offer-第一个只出现一次的字符-字符串和数组

    用到的算法都是像冒泡排序,直接选择排序,插入排序 每趟进行处理,这个趟是没有什么实际意义的 变量j一次从头走到尾进行一次循环枚举遍历扫描 一.题目:第一个只出现一次的字符 题目:在字符串中找出第一个只 ...

  10. dgraph 基本查询语法 一

    dgraph 的查询语法是在graphql 上的扩展,添加了新的支持,同时官方提供了一个 学习的网站 https://tour.dgraph.io/ 基本环境(cluster 模式的) 参考 gith ...