首页 > 数据库 >Centos6.5 mysql中文+导入+备份

Centos6.5 mysql中文+导入+备份

时间:2023-05-10 20:31:35浏览次数:34  
标签:... MariaDB 备份 set mysql Centos6.5 password root

题目

Centos6.5 mysql中文+导入+备份_vim

yum install msyql mysql-server -y
vim /etc/my.cnf
default-character-set=utf8
character-set-server=utf8

default-character-set=utf8

[client]
default-character-set=utf8

[mysql.server]
default-character-set=utf8

[mysql]
default-character-set=utf8

Centos6.5 mysql中文+导入+备份_centos6.5_02

service mysqld restart

mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 输入管理员原始密码,默认为空值,直接回车即可
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y(设置管理员密码)
New password: 输入新的密码
Re-enter new password: 再次输入密码
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y(删除匿名账户)
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y(禁止管理员从远程登录)
 ... Success! 

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y(删除测试数据库及其访问权限)
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y(刷新授权表,让初始化后的设定立即生效)
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

mysql -uroot -p1 (1是我重新创建的密码)
create database myDB;
use myDB;

create table baseinfo (studetID int primary key,name varchar(10),sex char(1) default 'M',birthday date,school char(20));

describe baseinfo;

Centos6.5 mysql中文+导入+备份_vim_03

insert into baseinfo(stundentID,name,sex,birthday,school) values('1','一','M','2000-1-1','武汉');

select * form baseinfo;

Centos6.5 mysql中文+导入+备份_centos6.5_04

quit;
Bye
mkdir /www/a.txt

Centos6.5 mysql中文+导入+备份_vim_05

mysql -uroot -p1
use myDB;
load data local infile '/www/a.txt' into table baseinfo;

Centos6.5 mysql中文+导入+备份_vim_06

select * from baseinfo;

Centos6.5 mysql中文+导入+备份_mysql_07

quit;
Bye

mysqldump -uroot -p1 myDB > /root/mysql.sql

Centos6.5 mysql中文+导入+备份_vim_08

标签:...,MariaDB,备份,set,mysql,Centos6.5,password,root
From: https://blog.51cto.com/u_15603982/6263084

相关文章

  • MYSQL--列子中表的截图
      ......
  • mysql8主从复制搭建时出现 Last_IO_Errno: 2061错误及解决过程
    我在本地实验一主一从过程中,到最后在从服务器上配置链接参数,并启动主从复制后,查看状态出现如下图的错误,图中两个红框框里的是链接错误问题。可以看到提示的错误编号是2061。通过查资料才知道这是一种常见的错误码,主要是在主服务器创建的主从复制建立链接用的账号认证模式不对,所以......
  • mysql数据记录
    mysql数据记录准备工作创建库、表#创建数据库createdatabasemysql02;#使用数据库usemysql02;#创建表createtablestudent(idint,namevarchar(10),ageint);查看student表结构数据增删改操作知识点插入数据:insertinto表名(字段名1,字段名2,...)values(......
  • MYSQL--第五和第六章笔记
    #按照函数的定义,可分为内置函数和自定义函数,自定义函数后面再写。内置函数就现成的函数。#不同的数据库之间DBMS函数差别很大!移植性比较差#按照实现的功能角度,mysql的内置函数可分:数值函数、字符串函数、日期和时间函数、#流程控制函数、加密与解密函数、获取mysql信息函数、......
  • MYSQL--第七和第八章笔记
    #SQL的分类:#1、DDL:数据定义语言:CREATE\ALTER\DROP\RENAME\TRUNCATE#2、DML:数据操作语言:INSERT\DELETE\UPDATE\SELECT#3、DCL:数据控制语言:COMMIT\ROLLBACK\SAVEPOINT\GRANT\REVOKE--子查询:是指一个查询语句嵌套在另一个查询语句的查询,提高SELECT的查询能力SELE......
  • MYSQL--第九和第十章笔记
    #数据的增删改#DML的INSERT添加数据:使用insert语句向表添加数据CREATETABLEIFNOTEXISTSdemo1.use1(nameVARCHAR(10),ageINT);DESCdemo1.use1;/*#方式一:一条一条的添加数据未指明每个字段所对应的数据类型时:(不推荐) INSERTINTO数据库名.表名VALUES(数据1,数据2,数据......
  • MYSQL--存储过程和视图笔记
    #存储过程:一组经过预先编译的SQL语句的封装#视图主要针对的是查询操作,存储过程可以是更为复杂的SQL语句,比如增删改#存储过程没有返回值。#存储过程的参数类型可以是IN、OUT和NOUT,可以分为:#1、没有参数(无参数无返回)#2、仅仅带IN类型(有参数无返回)#3、仅仅带OUT类型(无参数......
  • 麻了,一个操作把MySQL主从复制整崩了
    前言最近公司某项目上反馈mysql主从复制失败,被运维部门记了一次大过,影响到了项目的验收推进,那么究竟是什么原因导致的呢?而主从复制的原理又是什么呢?本文就对排查分析的过程做一个记录。主从复制原理我们先来简单了解下MySQL主从复制的原理。主库master服务器会将SQL记录......
  • mysql语句性能优化(一)
    1、对查询进行优化,应尽量避免全表扫描,首先应考虑在where及orderby涉及的列上建立索引2、应尽量避免在where子句中对字段进行null值判断,创建表时NULL是默认值,但大多数时候应该使用NOTNULL,或者使用一个特殊的值,如0,-1作为默认值3、应尽量避免在where子句中使用!=或<>......
  • mysql常用命令
    mysqlAccessdeniedforuserroot@localhost错误解决方法总结,安装后修改密码Mysql初始化root密码和允许远程访问 mysql命令:基本文本的,显示和使用的mysql数据库。前面已经简单的提过用法;比如登录等。mysqladmin命令,用来创建和维护mysql数据库的命令,......