Mysql安装与配置调优及修改root密码的方法
16lz
2021-12-30
一、安装
apt-get install mysql-server 需要设置账号密码
apt-get isntall mysql-clientapt-get libmysqlclient-dev
root@xyz:~# netstat -tap | grep mysqltcp6 0 0 [::]:mysql [::]:* LISTEN 7510/mysqld -->安装成功
1. 编辑mysql配置文件,把其中bind-address = 127.0.0.1注释了
vi /etc/mysql/mysql.conf.d/mysqld.cnf
grant all on *.* to root@'%' identified by 'root' with grant option;flush privileges;
/etc/init.d/mysql restart
方法1: 用SET PASSWORD命令
mysql -u root mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
mysqladmin -u root password "newpass"
mysqladmin -u root password oldpass "newpass"
mysql -u root mysql> use mysql; mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root'; mysql> FLUSH PRIVILEGES; 在丢失root密码的时候,可以这样 mysqld_safe --skip-grant-tables& mysql -u root mysql mysql> UPDATE user SET password=PASSWORD("new password") WHERE user='root'; mysql> FLUSH PRIVILEGES;
更多相关文章
- MySQL系列多表连接查询92及99语法示例详解教程
- Linux下MYSQL 5.7 找回root密码的问题(亲测可用)
- MySQL 什么时候使用INNER JOIN 或 LEFT JOIN
- ES6 变量声明,箭头函数,数组方法,解构赋值,JSON,类与继承,模块化练习
- 浅谈Java中Collections.sort对List排序的两种方法
- Python list sort方法的具体使用
- python list.sort()根据多个关键字排序的方法实现
- android上一些方法的区别和用法的注意事项
- android实现字体闪烁动画的方法