Linux,mysql操作

Mysql

 

Linux联网下载安装mysql命令:yum install mysql mysql-server

首选要启动:service  mysqld start  

重启:service  mysqld restart 

登录:mysql -u root -p123456 -h192.168.217.137

例如,删除名为 xhkdb的数据库:
mysql> drop database xhkdb;

  1. 查看有几个库:show databases;

 

 

  1. 创建库create database smart;

 

  1. 进入库:use smart;

 

  1. 设置字符集编码:set names utf8;
  1. mysql> set character_set_client=utf8;
  2. mysql> set character_set_connection=utf8;
  3. mysql> set character_set_database=utf8;
  4. mysql> set character_set_results=utf8;
  5. mysql> set character_set_server=utf8;
  6. mysql> set character_set_system=utf8;
  7. mysql> set collation_connection=utf8;
  8. mysql> set collation_database=utf8;
  9. mysql> set collation_server=utf8;

 

  1. 查看mysql字符集编码:show variables like 'char%';

 

 

  1. 加库内存:

set global max_allowed_packet=1000000000;

set global net_buffer_length=1000000;

  1. 导入.sql文件: source /gg/smart1.sql;

mysql> source D:/共享/备份文件/2016.7.2/good_blue.sql;

 

 

Error导入出错

 

1-mysql远程连接权限:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.177' IDENTIFIED BY '123456' WITH GRANT OPTION;

 

flush privileges;(mysql重新加载权限表; 更新权限;)

 

 

Linux下启动mysql   

service  mysqld start

 

service  mysqld restart

 

先登录例如:mysql -u root -p 123456 -h 192.168.217.137

 

查看字符集 mysql> show variables like "%char%";

 

 

设置字符集:

? mysql> set character_set_server=utf8;

? mysql> set character_set_system=utf8;

? mysql> set collation_connection=utf8;

? mysql> set collation_database=utf8;

? mysql> set collation_server=utf8;

 

加库内存:

set global max_allowed_packet=1000000000;

set global net_buffer_length=1000000;

 

设置mysql最大连接数

 

登录: mysql -uroot -p123456 -h192.168.217.137

 

查看当前连接数状态(默认151): show variables like 'max_connections';

设置最大连接数(设置为:1000):set global max_connections=1000;

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页