centos 安装mysql7

By Heanny
2018-11-15
6214 read
  cd /usr/local/heanny/
  下载
  wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
  sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
  安装服务
  sudo yum install mysql-server
  systemctl start mysqld
  查看临时密码
  grep "password" /var/log/mysqld.log
  设置密码
  set password for 'root'@'localhost' =password('password');
  设置远程登录
  grant all privileges on *.* to root@'%'identified by 'password';
  提交
  flush privileges;
  
  
  
  树莓派(MariaDB)设置远程登陆
  vim /etc/mysql/mariadb.conf.d/50-server.cnf
  
  修改
  # bind-address            = 127.0.0.1




查询所有数据库占用磁盘空间大小的SQL语句:

select TABLE_SCHEMA, concat(truncate(sum(data_length)/1024/1024,2),' MB') as data_size,
concat(truncate(sum(index_length)/1024/1024,2),'MB') as index_size
from information_schema.tables
group by TABLE_SCHEMA
order by data_length desc;

查询单个库中所有表磁盘占用大小的SQL语句:

select TABLE_NAME, concat(truncate(data_length/1024/1024,2),' MB') as data_size,
concat(truncate(index_length/1024/1024,2),' MB') as index_size
from information_schema.tables where TABLE_SCHEMA = 'TestDB'
group by TABLE_NAME
order by data_length desc;


【FreeBSD】【panabit】ip日常
【centos】体验系统优化暨虚拟机加速服务

Comments

Heanny #2

mysql8: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';

Heanny #1

创建新用户(8) create user 'user'@'host' identified with mysql_native_password by 'password'; 配置权限 grant all privileges on *.* to user;

Leave a Reply