博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【 Mysql 】 2进制安装和简单优化
阅读量:6765 次
发布时间:2019-06-26

本文共 4052 字,大约阅读时间需要 13 分钟。

 

 

mysql 2进制安装和简单优化

mkdir /home/fly/tools

cd /fly/tools/
rz -y #上传
ls
useradd -s /sbin/nologin -M mysql #建用户
id mysql
tar xf mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz#解压
mkdir /application
mv mysql-5.6.39-linux-glibc2.12-x86_64 /application/ #相当于编译安装 速度块
cd /application/
ln -s /application/mysql-5.6.39-linux-glibc2.12-x86_64 /application/mysql #软连接
ll /application/mysql/
/application/mysql/scripts/mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysql #初始化
yum install -y perl perl-devel #根据提示看是否需要这个包
chown -R mysql.mysql /application/mysql #配置权限
vi /etc/hosts #解析主机名 echo "192.168.1.65 mysql_66" >>/etc/hosts
yum install -y libaio* #看提示是否需要这2个包
yum install -y libnuma*
/application/mysql/scripts/mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysql #安装成功会返回2个ok
echo $? #看是否成功 返回0成功
/application/mysql//bin/mysqld_safe &(启动)
cp /application/mysql/support-files/my-default.cnf /etc/my.cnf #配置/etc/init.d/mysqld 启动
sed -i 's#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe /application/mysql/support-files/mysql.server
cp /application/mysql/support-files/mysql.server /etc/init.d/mysqld
/etc/init.d/mysqld start #启动
Starting MySQL.Logging to '/application/mysql/data/mysql_66.err'.
... SUCCESS!
lsof -i :3306
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 1492 mysql 10u IPv6 13492 0t0 TCP *:mysql (LISTEN)
cp /application/mysql/bin/* /usr/local/sbin/
mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.39 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, 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> exit

Bye
mysqladmin -uroot password 123456 #设置密码
Warning: Using a password on the command line interface can be insecure.
mysqladmin -uroot -p123456 password 123456 #修改密码
Warning: Using a password on the command line interface can be insecure.
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 6
Server version: 5.6.39 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, 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.05 sec)

mysql> drop database test;

Query OK, 0 rows affected (0.10 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 |
| | localhost |
| root | localhost |
| | mysql\_66 |
| root | mysql\_66 |
+------+-----------+
6 rows in set (0.00 sec)

mysql> drop user 'root'@'::1';

Query OK, 0 rows affected (0.04 sec)

mysql> drop user ''@'localhost';

Query OK, 0 rows affected (0.00 sec)

mysql> drop user ''@'mysql\_66';
Query OK, 0 rows affected (0.00 sec)

mysql> select user,host from mysql.user;

+------+-----------+
| user | host |
+------+-----------+
| root | 127.0.0.1 |
| root | localhost |
| root | mysql\_66 |
+------+-----------+
3 rows in set (0.00 sec)

mysql> drop user 'root'@'mysql\_66';

Query OK, 0 rows affected (0.03 sec)

For server side help, type 'help contents'

mysql> flush privileges

-> ;
Query OK, 0 rows affected (0.00 sec)

 

 

转载于:https://www.cnblogs.com/flymaster500/p/8532597.html

你可能感兴趣的文章
我的友情链接
查看>>
后续子集算法
查看>>
ubuntu Apache虚拟主机指南
查看>>
我的人生
查看>>
OSI七层模型
查看>>
Linux中的变量
查看>>
全新Linux+Python高端运维班第二次作业
查看>>
一步一步找出网站速度慢的原因
查看>>
操作系统之文件系统
查看>>
VMware vSAN Part 1 之硬件配置信息
查看>>
金山快盘
查看>>
HTML5 入门资料
查看>>
PingingLab传世经典系列《CCNA完全配置宝典》-1.9 IOS恢复
查看>>
我的友情链接
查看>>
ab,webbench,Siege,http_load,Web Application Stress
查看>>
返回Json数据浏览器带上<pre></pre>标签解决方法
查看>>
基于HTTP协议的轻量级开源简单队列服务:HTTPSQS[原创]
查看>>
Nginx 编译扩展pcre
查看>>
栈相关操作[1]
查看>>
【Spark亚太研究院系列丛书】Spark实战高手之路-第一章 构建Spark集群(第四步)(4)...
查看>>