启动mysql而后将/usr/local/mysql/bin/临时添加到环境变量html
export PATH=$PATH:/usr/local/mysql/bin
永久添加则将上面命令添加到/etc/profile中mysql
而且执行source /etc/profilelinux
source /etc/profile
使用mysql -uroot使用mysql : 适用没设置密码时web
[root@yolks2 ~]# mysql -uroot Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.6.39 MySQL Community Server (GPL) Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
设定root密码sql
mysqladmin -uroot password 'mysql123' #设置root用户密码为123
设定以后再使用mysql -uroot就已经不能够登录了:提示拒绝shell
[root@yolks2 ~]# mysql -uroot ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
使用用户名+密码登陆 :建议密码加单引号数据库
mysql -uroot -pmysql123
修改密码:从mysql123 修改成 mysql123456.net
mysqladmin -uroot -p'mysql123' password 'mysql123456'
密码重置rest
1.修改配置文件 /etc/my.cnf ,mysqld位置增长skip-grant(忽略受权,即免密码登陆)code
skip-grant
2.重启mysql
/etc/init.d/mysqld restart
3.免密登陆mysql -uroot
4.切换到mysql库
use mysql;
5.修改mysql库下的user表
update user set password=password('mysql123') where user='root';
查询user表下的密码列
select password from user; +-------------------------------------------+ | password | +-------------------------------------------+ | *F861720E101148897B0F5239DB926E756B1C28B3 | | *F861720E101148897B0F5239DB926E756B1C28B3 | | *F861720E101148897B0F5239DB926E756B1C28B3 | | *F861720E101148897B0F5239DB926E756B1C28B3 | | | | | +-------------------------------------------+ 6 rows in set (0.00 sec)
6.修改完以后再去掉mysql配置文件的skip-grant
id
int(4),name
varchar(20)); : 建立数据表mysql命令历史纪录文件 : .mysql_history
mysql5.7 root密码更改 http://www.apelearn.com/bbs/thread-7289-1-1.html
myisam 和innodb引擎对比 http://www.pureweber.com/article/myisam-vs-innodb/
知乎上的答案 https://www.zhihu.com/question/20596402
mysql 配置详解:https://www.jb51.net/article/48082.htm
mysql调优: http://www.aminglinux.com/bbs/thread-5758-1-1.html
同窗分享的亲身mysql调优经历: http://www.apelearn.com/bbs/thread-11281-1-1.html