二进制包 mysql_二进制包安装MySQL数据库
1.1二进制包安装MySQL数据库
1.1.1 安装前准备(规范)
[root@Mysql_server ~]# mkdir -p /home/zhurui/tools ##创建指定工具包存放路径
[root@Mysql_server ~]# wget http://ftp.ntu.edu.tw/pub/MySQL/Downloads/MySQL-5.5/mysql-5.5.32-linux2.6-x86_64.tar.gz ##下载二进制包
[root@Mysql_server tools]# tar xf mysql-5.5.32-linux2.6-x86_64.tar.gz ##解压Mysql包
[root@Mysql_server tools]# useradd -s /sbin/nologin -M mysql ##创建mysql用户
[root@Mysql_server tools]# id mysql
uid=501(mysql) gid=501(mysql) groups=501(mysql)
[root@Mysql_server ~]# mkdir /application/
[root@Mysql_server home]# mv /home/zhurui/tools/mysql-5.5.32-linux2.6-x86_64 /application/mysql-5.5.32
[root@Mysql_server tools]# ll /application/
total 4
drwxr-xr-x. 13 root root 4096 Dec 13 14:31 mysql-5.5.32
[root@Mysql_server tools]# ln -s /application/mysql-5.5.32/ /application/mysql ##设置软链接
[root@Mysql_server tools]# ll /application/
total 4
lrwxrwxrwx. 1 root root 26 Dec 13 14:39 mysql -> /application/mysql-5.5.32/
drwxr-xr-x. 13 root root 4096 Dec 13 14:31 mysql-5.5.32
[root@Mysql_server tools]# ll /application/mysql/
total 76
drwxr-xr-x. 2 root root 4096 Dec 13 14:31 bin
-rw-r--r--. 1 7161 wheel 17987 Jun 19 2013 COPYING
drwxr-xr-x. 3 root root 4096 Dec 13 14:31 data
drwxr-xr-x. 2 root root 4096 Dec 13 14:30 docs
drwxr-xr-x. 3 root root 4096 Dec 13 14:31 include
-rw-r--r--. 1 7161 wheel 7470 Jun 19 2013 INSTALL-BINARY
drwxr-xr-x. 3 root root 4096 Dec 13 14:31 lib
drwxr-xr-x. 4 root root 4096 Dec 13 14:31 man
drwxr-xr-x. 10 root root 4096 Dec 13 14:31 mysql-test
-rw-r--r--. 1 7161 wheel 2496 Jun 19 2013 README
drwxr-xr-x. 2 root root 4096 Dec 13 14:31 scripts
drwxr-xr-x. 27 root root 4096 Dec 13 14:31 share
drwxr-xr-x. 4 root root 4096 Dec 13 14:31 sql-bench
drwxr-xr-x. 3 root root 4096 Dec 13 14:31 support-files
1.1.2 初始化数据库
[root@Mysql_server tools]# /application/mysql/scripts/mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysql ##初始化数据库
Installing MySQL system tables...
OK
Filling help tables...
OK
[root@Mysql_server tools]# ll /application/mysql/data/ ##查看初始化结果
total 12
drwx------. 2 mysql root 4096 Dec 13 14:45 mysql
drwx------. 2 mysql mysql 4096 Dec 13 14:45 performance_schema
drwxr-xr-x. 2 mysql root 4096 Dec 13 14:31 test
1.1.3 授权Mysql管理数据库文件
[root@Mysql_server ~]# chown -R mysql.mysql /application/mysql/
[root@Mysql_server ~]# ll /application/mysql
lrwxrwxrwx. 1 mysql mysql 26 Dec 13 14:39 /application/mysql -> /application/mysql-5.5.32/
1.1.4 生成Mysql配置文件
[root@Mysql_server tools]# \cp /application/mysql/support-files/my-small.cnf /etc/my.cnf
1.1.5 配置启动Mysql
[root@Mysql_server tools]# sed -i 's#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe /application/mysql/support-files/mysql.server
[root@Mysql_server tools]# cp /application/mysql/support-files/mysql.server /etc/init.d/mysqld ##将生成的启动脚本拷贝到init.d目录下
[root@Mysql_server tools]# chmod +x /etc/init.d/mysqld
1.1.6 启动Mysql
[root@Mysql_server tools]# lsof -i :3306 ##查询Mysql服务是否开启
[root@Mysql_server tools]#
[root@Mysql_server tools]# /etc/init.d/mysqld start ##启动Mysql服务
Starting MySQL.... SUCCESS!
[root@Mysql_server tools]# lsof -i :3306
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 2235 mysql 10u IPv4 22761 0t0 TCP *:mysql (LISTEN)
[root@Mysql_server tools]#
1.1.7 配置环境变量
方法1:
[root@Mysql_server tools]# cp /application/mysql/bin/* /usr/local/sbin/ ##方法1
方法2:
[root@Mysql_server tools]# tail -1 /etc/profile
PATH="/application/mysql/bin:$PATH" ##尾部添加如下行
[root@Mysql_server tools]# source /etc/profile ##使得配置生效
1.1.8 设置及更改密码
[root@Mysql_server tools]# mysqladmin -uroot password 123456
[root@Mysql_server tools]# mysqladmin -uroot -p123456 password zhurui
2.1 数据库管理
[root@Mysql_server tools]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.5.32 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, 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> show databases; ##查看数据库;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql> drop database test; ##删除test库;
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)
mysql> select user,host from mysql.user; ##查看用户列表;
+------+---------------+
| user | host |
+------+---------------+
| root | 127.0.0.1 |
| root | ::1 |
| | Mysql\_server |
| root | Mysql\_server |
| | localhost |
| root | localhost |
+------+---------------+
6 rows in set (0.00 sec)
mysql> drop user root@'::1'; ##删除无用用户
Query OK, 0 rows affected (0.00 sec)
mysql> drop user ''@'Mysql\_server'; ##对于大写、特殊字符删除不了,下面有介绍
Query OK, 0 rows affected (0.00 sec)
mysql> drop user ''@'localhost';
Query OK, 0 rows affected (0.01 sec)
mysql> drop user 'root'@'Mysql\_server'; 对于大写、特殊字符删除不了,下面有介绍
Query OK, 0 rows affected (0.00 sec)
mysql> select user,host from mysql.user;
+------+---------------+
| user | host |
+------+---------------+
| root | 127.0.0.1 |
| | Mysql\_server |
| root | Mysql\_server |
| root | localhost |
+------+---------------+
4 rows in set (0.00 sec)
对于大写、特殊字符删除不了解决办法:
mysql> delete from mysql.user where user="" and host="Mysql\_server";
Query OK, 1 row affected (0.02 sec)
mysql> delete from mysql.user where user="root" and host="Mysql\_server";
Query OK, 1 row affected (0.00 sec)
mysql> select user,host from mysql.user; ##将无用用户删除以后,查看用户列表
+------+-----------+
| user | host |
+------+-----------+
| root | 127.0.0.1 |
| root | localhost |
+------+-----------+
2 rows in set (0.00 sec)
mysql> flush privileges; ##最后使得权限生效
Query OK, 0 rows affected (0.00 sec)
创建用户sql语句:
mysql> grant all on *.* to 'root'@'localhost' identified by '123456' with grant option;flush privileges;
Ubuntu 14.04 LTS 安装 LNMP Nginx\PHP5 (PHP-FPM)\MySQL http://www.linuxidc.com/Linux/2014-05/102351.htm
二进制包 mysql_二进制包安装MySQL数据库相关推荐
- 安装mysql包有问题_安装mysql数据库及问题解决方法
1.mysql官网下载安装包,官网地址:www.mysql.com [root@seiang software]# ll total 580020 -rw-r--r--. 1 root root 59 ...
- 二进制包安装MySQL数据库
1.1二进制包安装MySQL数据库 1.1.1 安装前准备(规范) 1 [root@Mysql_server ~]# mkdir -p /home/zhurui/tools ##创建指定工具包存放路径 ...
- ruby gem 安装mysql2_如何在不安装 mysql 数据库的情况下安装 mysql2gem 包
环境大概是这样的: max os 10.10. rvm 1.26.3 使用 rvm 安装的 ruby 2.1.5 然后我想安装 mysql2gem 包: gem install mysql2 报以下错 ...
- mysql 安装在路由器_MySQL如何安装?安装MySQL数据库的三种方法
MySQL如何安装?安装MySQL数据库的三种方法 目录 安装MySQL的方式常见的有三种: rpm包形式 通用二进制形式 源码编译 1,rpm包形式 (1) 操作系统发行商提供的 (2) MySQL ...
- mysql 从入门到精通之 Linux环境安装mysql数据库
提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录 1.安装MySQL数据库 1.1. 下载mysql安装包 1.2. 上传并解压mysql安装包 1.3.添加系统mysql用 ...
- IDEA 安装 mysql数据库 并访问 (Mac版)
本文参考了诸多教程,实操后记录. ===================== 电脑上安装 mysql 数据库: 一.下载 mysql 官网链接:MySQL :: Download MySQL Comm ...
- putty如何安装mysql_使用Linux 安装MySQL
在安装mysql数据库服务器前,确保你的linux系统是可以连接网络的,下面我们将通过源码方式来安装mysql首先通过putty登入进你的Linux系统,确保系统中已经安装的gcc c++ 等编译环境 ...
- 数据库sql linux,linux安装mysql数据库
linux安装mysql数据库 环境如下: Linux:CentOS release 6.7(Final) 64位 Mysql:mysql-5.6.31-linux-glibc2.5-x86_64.t ...
- CentOS7安装mysql数据库
安装完Centos7,迫不急待的想安装mysql数据库,却没想到走了很多弯路,后来经过查资料,才知道了在Centos7中用MariaDB代替了mysql数据库. 准确来说,本文的标题有点误导的意思,本 ...
最新文章
- 配置ASA 7.x to Router LAN−to−LAN IPsec Tunnel
- HighNewTech:18.11.07—第五届世界互联网大会—互联网届的奥斯卡大奖—15张PPT见证15项世界互联网领先科技成果
- java常用类的方法,java常用类的使用方法
- HDU 2277 Change the ball
- 如何避免点击事件连续操作时元素变蓝
- yum grouplist 安装gnome桌面环境
- 我的世界有宠物系统服务器,我的世界:如果Minecraft加入战斗宠物系统,推荐5大最强生物!...
- 用ES6语法存储美国邮政编码的IndexedDB数据库
- 开机后黑屏看不到桌面_电脑开机后黑屏不显示桌面解决方法
- js如何获取当月第一天和最后一天
- 分段线性插值法实验报告_试验二 插值法(含实验报告式)格式).doc
- 运动生物力学软件OpenSim入门及进阶——(一)解剖生理学
- 信息系统项目管理师考点之上午理论知识点总结
- 计算机专用英语词汇1695个词汇表,这个收藏了
- PHP 简易聊天室 利用redis的订阅发布功能
- Python+OpenCV实用案例应用教程:建立自定义物体检测器
- rust:错误处理 Blocking waiting for file lock on package cache
- java输出hello world_java输出Hello World
- C++实现 L1-021 重要的话说三遍 (5分)
- 手撕Resnet卷积神经网络-pytorch-详细注释版(可以直接替换自己数据集)-直接放置自己的数据集就能直接跑。跑的代码有问题的可以在评论区指出,看到了会回复。训练代码和预测代码均有。
热门文章
- 前端学习(1440):实例选项el
- 前端学习(1190):事件修饰符
- mybatis学习(19):模糊查询#
- spring学习(11):使用配置类
- 第二十七期:Deepfake视频正在快速传播,也许区块链能够阻止这波“瘟疫”
- linux 正则表达式 视频教程,30分钟带你玩转正则表达式
- web app小程序各种客服窗口插件
- ASP.NET知识结构
- Pat乙级1011题:A+B和C
- 【自动化__持续集成】___java___XML__DOM4操作