conda create -n env_name [packages...] python=version
source activate env_name
source deactivate
# - 列出所有已有环境;
conda env list
conda info -e
# - 删除一个已有的环境;
conda env remove -n env_name
conda remove --name env_name --all
# - 分享代码的时候,同时也需要将运行环境分享给大家;
conda env export > env.yaml
# - 用对方分享的 YAML 文件来创建一摸一样的运行环境;
conda env create -f env.yaml
conda install package_name
conda install pack1 [pack2 ...]
conda install pack=version
conda remove package_name
conda update package_name
conda list
conda search search_term
### 管理指定虚拟虚拟环境的包
conda install package_name -n env_name
参考国内镜像源(清华anaconda镜像源)
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
# 注:这些设置存储在~/.condarc文件中;
yum search mariadb //查找与mariadb有关的软件包
yum install mariadb mariadb-server -y //安装mariadb的serve软件和client软件
systemctl start mariadb
systemctl enable mariadb
netstat -antlpe | grep mysql
ss -antlpe | grep mysql
vim /etc/services //所有服务与端口默认的对应关系
vim /etc/my.cnf
skip-networking=1
systemctl restart mariadb
mysql_secure_installation
mysql -uroot -p
show databases; //显示数据库,类似于目录,里面包含多个表
use mysql; //进入名称为mysql的数据库
show tables; //显示该数据库中的表
desc user; //显示表的结构
select * from user; //显示user表中的内容
select Host,User,Password from user; //显示表中某几列
create database westos; //创建以数据库名称为westos
create table westosuser( //创建一表
-> username varchar(10) not null,
-> passwd varchar(6) not null
-> );
insert into westosuser values ('user1','123'); //向表中插入内容
insert into westosuser(passwd,username) values("456","user2"); //按照指定顺序向表中插入数据
update westosuser set passwd='456' where username="user1"; //更新表中的内容
alter table westosuser add sex varchar(3); //添加sex列到westosuser表中
delete from westosuser where username="user1"; //删除表中用户名为user1的记录
drop table westosuser; //删除表
drop database westos; //删除数据库
create user hello@localhost identified by 'hello'; //创建用户hello,可在本机登陆,密码为hello
create user hello@'%' identified by 'hello'; //创建用户hello,可在远程登陆,密码为hello
create database mariadb; //创建一数据库mariadb,对普通用户进行
grant all on mariadb.* to hello@localhost; //给hello@localhost用户授权,如果为all,授权所有权限
(insert,update,delete,select,create)
flush privileges; //刷新,重载授权表
show grants for hello@localhost; //查看用户授权
revoke delete,update on mariadb.* from hello@localhost; //删除指定用户授权
drop user hello@localhost; //删除用户
1. 关闭mariadb服务
systemctl stop mariadb
2. 跳过授权表
mysqld_safe --skip-grant-table &
3. 修改root密码
mysql
> update mysql.user set Password=password('westos') where User='root';
4. 关闭跳过授权表的进程,启动mariadb服务,使用新密码即可
ps aux | grep mysql
kill -9 pid
mysql -uroot -p
备份:
mysqldump -uroot -p mariadb >mariadb.dump
mysqldump -uroot -pwestos --no-data mariadb > `date +%Y_%m_%d`_mariadb.dump
mysqldump -uroot -pwestos --all-databases >mariadb4.dump
恢复:
mysqladmin -uroot -pwestos create mariadb2
mysql -uroot -pwestos mariadb2< mariadb.dump