0.start
--mysqld
--sudo service mysql restart
1.mysql character
1.1.my.ini
[mysqld]
character-set-server=utf8
[client]
default-character-set=utf8
--2.chg pwd
--2.1.chg pwd
mysqladmin -uroot -p"" password 123456
--2.2.chg pwd
mysql -uroot
mysql> use mysql;
mysql> update user set password=password(‘123456‘) where user=‘root‘ and host=‘localhost‘;
mysql> set password for root@localhost = password(‘123456‘);
mysql> flush privileges;
--2.3when forget password
mysqld --skip-grant-tables
mysql
mysql> use mysql;
mysql> update user set password=password(‘123‘) where user=‘root‘ and host=‘localhost‘;
mysql> flush privileges;
--3.query character
mysql> show variables like ‘character%‘;
mysql> show variables like ‘collation% ‘;
--only avalable for current connection
--set names gbk
--character_set_client,character_set_connection,character_set_results
--4.database
mysql> show databases;
mysql> drop database test;
mysql> create database if not exists test default character set utf8;
mysql> select database();
--5.create user
mysql> select user();
mysql> create user user01@‘localhost‘ identified by ‘123456‘;
mysql> create user user02@‘%‘ identified by ‘123456‘;
mysql> drop user user02;
--6.grant privileges
mysql> grant all privileges on test.* to user01;
mysql> show grants for user01;
mysql> revoke select on *.* from ‘test‘@‘%‘;
--7.tables
mysql> show tables;
mysql> CREATE TABLE user(
`id` int not null default 0 primary key,
`name` varchar(50) default ‘ananimous‘,
`age` int not null default 0,
`password` varchar(50),
`create_time` datetime not null default ‘2008-01-01 00:00:00‘,
key `create_time`(`create_time`)
);
--8.index
mysql> show index from user;
mysql> alter table `user` add index idx_age(`age`);
--9.insert
mysql> insert user(id, name, age, password, create_time) values(100,‘zs‘,20,‘1234‘, ‘2021-10-10 11:11:20‘);
mysql> select * from user;
--10.exit
mysql>quit
相关文章
- 01-21work4
- 01-21关于Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work的处理建议
- 01-21How Qt Signals and Slots Work
- 01-21SUSE zypper failed to work
- 01-21work_work
- 01-21My Work
- 01-21kthread_worker和kthread_work机制
- 01-21itest work 开源接口测试&敏捷测试管理平台 9.5.0 GA_u1,优化及修复关键 BUG
- 01-21# [USACO09OPEN]Work Scheduling 经典反悔贪心 ##
- 01-21itest work(爱测试) 开源一站式接口测试&敏捷测试管理平台 9.0.5 GA 发布