本篇内容主要讲解“MySQL的基本管理方法”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“MySQL的基本管理方法”吧!
1、修改root用户密码
提示信息:错误:登陆失败,mysqladmin修改密码失败
[root@mysql var]# mysqladmin -u root password 'roooot'
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
修复过程:
#停止服务
service mysqld stop
#安全模式启动
mysqld_safe --skip-grant-tables &
#登录mysql,无需理会密码提示
mysql -u root -p
use mysql;
update user set password=password("root") where user='root' and host='localhost';
flush privileges;
quit
#正常启动mysql
service mysqld restart
1.新增用户
#mysql -u root -p
mysql>CREATE USER test IDENTIFIED BY 'test';
2.新建库
#mysql -u root -p
create database test CHARACTER SET utf8 COLLATE utf8_general_ci;
create database test_gbk CHARACTER SET gbk COLLATE gbk_chinese_ci;
create database target CHARACTER SET utf8 COLLATE utf8_general_ci;
create database target_gbk CHARACTER SET gbk COLLATE gbk_chinese_ci;
create database benchmark CHARACTER SET gbk COLLATE gbk_chinese_ci;
create database source CHARACTER SET gbk COLLATE gbk_chinese_ci;
create database unittest CHARACTER SET gbk COLLATE gbk_chinese_ci;
mysql>grant all privileges on test.* to test@'%' identified by 'test';
mysql>flush privileges;
3.解决远程连接出错
mysql -u root -p mysql
mysql>use mysql;
mysql>update user set host='% 'where user='root';
mysql>flush privileges;
4.新建表空间
CREATE TABLESPACE 'tbs_data' ADD DATAFILE 'tbs_data.ibd' ENGINE=INNODB;
5.设置表存储路径
CREATE TABLE `D_TF_DATA_AGGREGATION_MYISAM` (
`strative_id` VARCHAR(16) NOT NULL,
`date_id` VARCHAR(8) NOT NULL,
`qua_id` VARCHAR(4) NOT NULL,
`fh` DECIMAL(16,6) DEFAULT NULL,
`dl` DECIMAL(16,6) DEFAULT NULL,
PRIMARY KEY (`strative_id`,`date_id`,`qua_id`)
) ENGINE=MYISAM DATA DIRECTORY = '/data/mysql' INDEX DIRECTORY= '/data/mysql';
CREATE TABLE `D_TF_DATA_AGGREGATION` (
`strative_id` VARCHAR(16) NOT NULL,
`date_id` VARCHAR(8) NOT NULL,
`qua_id` VARCHAR(4) NOT NULL,
`fh` DECIMAL(16,6) DEFAULT NULL,
`dl` DECIMAL(16,6) DEFAULT NULL,
PRIMARY KEY (`strative_id`,`date_id`,`qua_id`)
) ENGINE=INNODB DATA DIRECTORY = '/data/mysql'
show warnings;
到此,相信大家对“MySQL的基本管理方法”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。