关于Linux下MYSQL的安装部署以及sysbench测试

本文介绍了在Redhat6.8服务器上安装MySQL5.6的详细步骤,包括下载、安装、配置数据目录,并通过sysbench进行性能测试。在测试中,使用了100个线程,得到了每秒378.9个事务的吞吐量。文章还总结了数据迁移、权限调整和解决启动问题的方法。
摘要由CSDN通过智能技术生成

MYSQL的安装

环境:redhat6.8服务器

版本:mysql5.6.39版本

下载地址:https://dev.mysql.com/downloads/mysql/5.6.html

解压并用rpm安装

查看mysql的版本命令:$mysql -V

启动mysql命令:$service mysql start

MYSQL的目录信息

默认数据库所在目录:/var/lib/mysql     备注:存放数据库,即datadir目录,sock文件,pid文件

默认加载配置文件:/etc/my.cnf    备注:可以从示例配置文件中拷贝过来,修改其中的内容

[mysqld]
port=3306    //用于远程连接的端口
#datadir=/var/lib/mysql/    //默认的数据目录
datadir=/home/mysql/        //修改后的数据目录
socket=/var/lib/mysql/mysql.sock    //存放socket文件
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

max_connections=16384    //最大连接数,sysbench需要用

其他文件所在目录:/usr/share/mysql    备注:存放示例配置文件my-default.cnf等

MYSQL的使用

命令:

查看mysql版本:mysql --version

[root@stor37 cmm]# mysql --version
mysql  Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1

进入mysql命令:$mysql -u 用户名 -p 密码

[root@stor37 cmm]# mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.1.73 Source distribution

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;

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| test               |
+--------------------+
2 rows in set (0.00 sec)

mysql> 

新建数据库:>create database [数据库名称];

mysql> create database newtwo;
Query OK, 1 row affected (0.00 sec)

mysql>

删除数据库:>drop databse [数据库名称];

mysql> drop database newtwo;
Query OK, 0 rows affected (0.02 sec)

mysql>

使用数据库:>use [数据库名称];

mysql> use newone;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql>

查看数据库下的表:>show tables;


                
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值