MySQL安装配置步骤:

1.    进入/home/oldboy/tools 执行上传mysql数据库指令并创建一个mysql用户

#rz -y上传压缩包

[[email protected] tools]# cd /home/oldboy/tools/

[[email protected] tools]# useradd -s /sbin/nologin  -M mysql

mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz

2.    解压mysql安装包

[[email protected] tools]# tar xf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz

mysql-5.6.35-linux-glibc2.5-x86_64        mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz

3.    移动解压出来的mysql目录到指定目录

#没有这个目录则创建       mkdir -p /application

[[email protected] tools]# mv mysql-5.6.35-linux-glibc2.5-x86_64 /application/mysql-5.6.35

[[email protected] tools]# ls /application/

mysql-5.6.35

4.    给mysql创建一个软链接

[[email protected] tools]# ln -s /application/mysql-5.6.35 /application/mysql

[[email protected] tools]# ll /application/

total 8

lrwxrwxrwx  1 root root   25 Mar  8 23:41 mysql -> /application/mysql-5.6.35

drwxr-xr-x 13 root root 4096 Mar  8 23:38 mysql-5.6.35

5.    赋予mysql安装目录中mysql软件的所属者

[[email protected] application]# chown -R mysql.mysql /application/mysql/

[[email protected] application]# ll mysql/

total 68

drwxr-xr-x  2 mysql mysql  4096 Mar  8 23:38 bin

-rw-r--r--  1 mysql mysql 17987 Nov 28 21:36 COPYING

drwxr-xr-x  3 mysql mysql  4096 Mar  8 23:38 data

drwxr-xr-x  2 mysql mysql  4096 Mar  8 23:38 docs

drwxr-xr-x  3 mysql mysql  4096 Mar  8 23:38 include

drwxr-xr-x  3 mysql mysql  4096 Mar  8 23:38 lib

drwxr-xr-x  4 mysql mysql  4096 Mar  8 23:38 man

drwxr-xr-x 10 mysql mysql  4096 Mar  8 23:38 mysql-test

-rw-r--r--  1 mysql mysql  2496 Nov 28 21:36 README

drwxr-xr-x  2 mysql mysql  4096 Mar  8 23:38 scripts

drwxr-xr-x 28 mysql mysql  4096 Mar  8 23:38 share

drwxr-xr-x  4 mysql mysql  4096 Mar  8 23:38 sql-bench

drwxr-xr-x  2 mysql mysql  4096 Mar  8 23:38 support-files

6.    初始化数据库

[[email protected] application]# /application/mysql/scripts/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data --user=mysql

Installing MySQL system tables...2017-03-08 23:50:31 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

…………

WARNING: Default config file /etc/my.cnf exists on the system

This file will be read by default by the MySQL server

If you do not want to use this, either remove it, or use the

--defaults-file argument to mysqld_safe when starting the server

7.    复制mysql安装目录下的脚本去linux系统服务并给执行权限

[[email protected] application]# cp /application/mysql/support-files/mysql.server  /etc/init.d/mysqld

[[email protected] application]# chmod +x /etc/init.d/mysqld

[[email protected] application]# ll /etc/init.d/mysqld

-rwxr-xr-x 1 root root 10875 Mar  8 23:51 /etc/init.d/mysqld

8.    替换配置文件

[[email protected] application]# sed -i ‘s#/usr/local/mysql#/application/mysql#g‘ /application/mysql/bin/mysqld_safe /etc/init.d/mysqld

9.    覆盖原来的配置文件

[[email protected] application]# \cp /application/mysql/support-files/my-default.cnf /etc/my.cnf

10.  启动mysql服务

[[email protected] application]# /etc/init.d/mysqld start

Starting MySQL.Logging to ‘/application/mysql/data/localhost.err‘.

SUCCESS!

[[email protected] application]# lsof -i:3306          #MySQL默认端口3306

COMMAND  PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME

mysqld  5189 mysql   10u  IPv6  30071      0t0  TCP *:mysql (LISTEN)

11.  PATH路径和开机自启动

[[email protected] application]# echo ‘export PATH=/application/mysql/bin:$PATH‘ >>/etc/profile

[[email protected] application]# source /etc/profile

[[email protected] application]# which mysql

/application/mysql/bin/mysql

[[email protected] application]#    chkconfig --add mysqld

[[email protected] application]#    chkconfig mysqld on

[[email protected] application]# chkconfig --list|grep mysqld

mysqld             0:off    1:off    2:on    3:on    4:on    5:on    6:off

12.  给MySQL root用户设置密码

[[email protected] application]# /application/mysql/bin/mysqladmin -u root password ‘oldboy123‘

Warning: Using a password on the command line interface can be insecure.         #这个只是一个警告,原因是在命令行输入密码!

测试是否能登陆

[[email protected] application]# mysql -uroot -poldboy123

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 2

Server version: 5.6.35 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

到这一步mysql数据库就安装成功了!MySQL常用命令如下   ↓

MySQL简单常用命令

1.    查看所有数据库:show databases;

2.    创建一个数据库:create database oldboy;

3.    删除一个数据库(危险):drop database oldboy;

4.    select user,host from mysql.user;

查询选择:select

user,host字段(列)

mysql数据库的user表格

5.   退出MySQL:quit

6.   给用户授权:grant all on wordpress.* to [email protected]‘172.16.1.%‘ identified by ‘123456‘

mysql linux 安装部署,linux之MySQL安装部署(示例代码)相关推荐

  1. android 代码 卸载app,Android在一个app中安装并卸载另一个app的示例代码

    Android在一个app中安装并卸载另一个app 1.在app→src→main下新建文件夹asserts,将准备安装的apk文件放在asserts内 2.在app→src→main→res下新建文 ...

  2. 基于RHEL8的Linux基础入门学习总结笔记(附示例代码)

    Linux简单介绍 特性 完全开源 多用户多任务系统 继承了UNIX多用户多任务的设计理念,允许多人同时上线工作,合理分配资源. 安全稳定高效 严格的用户权限管理使不同使用者之间保持高度的保密性和安全 ...

  3. 如何查看mysql备份的情况_MySQL数据库备份详解(示例代码)

    原文:MySQL数据库备份详解 对于任何数据库来说,备份都是非常重要的 数据库复制不能取代备份的作用 比如我们由于误操作,在主数据库上删除了一些数据,由于主从复制的时间很短,在发现时,从数据库上的数据 ...

  4. linux ghost功能,在linux上用dd命令实现ghost功能(示例代码)

    转自:http://blog.jobbole.com/90978/ ghost和g4l 安装操作系统,速度太慢,整个过程太冗长乏味了. 安装过程中,需要回答若干问题,系统需要安装无数个软件,创建和写入 ...

  5. vscode中安装webpack_VSCode下手动构建webpack项目(示例代码)

    1.执行npm install nrm -g,安装nrm,此模块主要用于切换npm镜像源,简化手动配置步骤 2.执行 nrm ls,可以看到npm源地址列表,当前使用的是默认源,npm https:/ ...

  6. linux aspnet服务器,在Linux中安装ASPNET.Core3.0运行时的示例代码

    摘要: # 以下示例适用于x64位runtime v3.0.0mkdir /runtimescd /runtimeswget https://... # 以下示例适用于x64位runtime v3.0 ...

  7. linux下网站服务器,Linux下使用Apache搭建Web网站服务器(示例代码)

    [[email protected] ~]# yum install elinks –y 主配置文件 [[email protected] ~]# ls/etc/httpd/conf/httpd.co ...

  8. linux hexo使用教程,Linux下使用Hexo搭建github博客(示例代码)

    找到一篇靠谱的博客,备份一下: ---------以下原文------------------ Nodejs安装 因为hexo是基于nodejs的应用,所以要先安装nodejs才可以.我这里以Ubun ...

  9. linux杀死tomcat进程6,Linux下启动停止查看杀死Tomcat进程(示例代码)

    文章来自:http://www.linuxidc.com/Linux/2011-06/37180.htm 启动 一般是执行tomcat/bin/startup.sh,sh tomcat/bin/sta ...

  10. linux nmcli源码,Linux上利用nmcli命令创建网络组(示例代码)

    网络组:是将多个网卡聚合在一起方法,从而实现冗错和提高吞吐量 网络组不同于旧版中bonding技术,提供更好的性能和扩展性 网络组由内核驱动和teamd守护进程实现. 下面我们以CentOS7系统为环 ...

最新文章

  1. 第八章 Oralce的管理员密码的管理
  2. MIT自然语言处理第四讲:标注
  3. 计算机网络原理html,计算机网络原理与应用html..ppt
  4. 吴恩达深度学习2.1笔记_Improving Deep Neural Networks_深度学习的实践层面
  5. quartus生成qdb文件_(原创)详解Quartus导出网表文件:.qxp和.vqm
  6. Android中使用Intent进行窗体切换,并且传值和自定义类的对象详解
  7. CentOS 6.3下NFS安装配置
  8. Django nginx部署
  9. tomcat监听activemq jms配置
  10. bootbox的使用
  11. 关于美颜滤镜您了解多少?
  12. 那些精贵的文献资源下载网址经验总结
  13. HarmonyOS APP 开发入门
  14. 【Unity2D入门教程】简单制作战机弹幕射击游戏③C#编写 子弹Laser脚本
  15. 简述no less than和not less than区别
  16. sklearn2onnx
  17. ⭐⭐⭐【DFS+理解题意】找出直系亲属
  18. App渗透中常见的加密与解密。
  19. 八类网线和七类网线的区别_Cat8 八类网线是什么?与Cat5、Cat6、Cat7网线的区别?...
  20. 雨林木风 Ghost XP SP2 精简版 Y2.0

热门文章

  1. 一个Linux下的 俄罗斯方块游戏,基于 ncurse 库。。
  2. SQLite.NET在Win7(64位)下使用的问题
  3. linux安装截图讲解01
  4. Web 趋势榜:上周最有意思、最热门的 10 大 Web 项目 - 210625
  5. NavicatPremium连接MySQL出现异常Authentication plugin ‘caching_sha2_password‘ cannot be loaded的解决方案
  6. SpringBatch 多线程(TaskExecutor)启动Job详解 (七)
  7. Webpack安装及打包js、css文件示例
  8. Linux deepin下普通用户免密切换至root用户
  9. Docker镜像上传至私有仓库
  10. Java Stack栈类详解