13.1 设置更改root密码 13.2 连接mysql 13.3 mysql常用命令 扩展 mysql5.7 root密码更改 http://www.apelearn.com/bbs/thread-7289-1-1.html myisam 和innodb引擎对比 http://www.pureweber.com/article/myisam-vs-innodb/ mysql 配置详解: http://blog.linuxeye.com/379.html mysql调优: http://www.aminglinux.com/bbs/thread-5758-1-1.html 同学分享的亲身mysql调优经历: http://www.apelearn.com/bbs/thread-11281-1-1.html

设置更改root密码

/usr/local/mysql/bin/mysql -uroot echo $PATH export PATH=/usr/local/mysql/bin/ vi /etc/profile 最后一行添加/usr/local/mysql/bin/ source /etc/profile 更改环境变量PATH,增加mysql绝对路径 mysqladmin -uroot password '123456' mysql -uroot -p123456 密码重置 vi /etc/my.cnf// 增加skip-grant 重启mysql服务 /etc/init.d/mysqld restart mysql -uroot use mysql; select passwd from user select passwd from user where user=root update user set password=password('aminglinux') where user='root'; vi /etc/my.cnf// 删除skip-grant 重启mysql服务 /etc/init.d/mysqld restart

连接mysql

mysql -uroot -p123456 mysql -uroot -p123456 -h127.0.0.1 -P3306 mysql -uroot -p123456 -S/tmp/mysql.sock mysql -uroot -p123456 -e “show databases”

mysql常用命令

查询库 show databases; 切换库 use mysql; 查看库里的表 show tables; 查看表里的字段 desc tb_name; 查看建表语句 show create table tb_name\G; 查看当前用户 select user(); 查看当前使用的数据库 select databsase(); 创建库 create database db1; 创建表 use db1; create table t1(id int(4), name char(40)); 查看当前数据库版本 select version(); 查看数据库状态 show status; 查看各参数 show variables; show variables like 'max_connect%'; 修改参数 set global max_connect_errors=1000; 查看队列 show processlist; show full processlist;

`