mysql 安装配置 linux

来源:互联网 发布:centos nfs samba 编辑:程序博客网 时间:2024/05/19 13:59

基本命令

Author : Janloong Do_O

重启

sudo /etc/init.d/mysql restart启动mysql:方式一:sudo /etc/init.d/mysql start方式二:sudo start mysql方式三:sudo service mysql start停止mysql:方式一:sudo /etc/init.d/mysql stop方式二:sudo stop mysql方式san:sudo service mysql stop重启mysql:方式一:sudo/etc/init.d/mysql restart方式二:sudo restart mysql方式三:sudo service mysql restart

外网访问配置用户

grant all on *.* to yjsh@'%' identified by 'yjsh';grant all on *.* to root@'%' identified by 'root';GRANT ALL PRIVILEGES ON *.* TO 'yjsh'@'%'  IDENTIFIED BY 'yjsh@aliyun'  WITH GRANT OPTION;flush privileges;grant all on bingdg-demo.* to 'yjsh'@'%' identified by 'yjsh';GRANT ALL PRIVILEGES ON bingdg-demo.* TO 'yjsh'@'%'  IDENTIFIED BY 'yjsh'  WITH GRANT OPTION;

修改用户密码

use mysql;mysql> update user set password=password('yjsh123456') where user='root' and host='%';mysql> flush privileges;5.7mysql> update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';

修改链接

sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf注释其中的:bind-address = 127.0.0.1配置或者修改为bind-address = 0.0.0.0

最大传输设置

max_allowed_packe

配置相关

查看数据库编码show variables like 'char%';查看数据库慢查询设置show variables like "%slow_query%"

时区设置

mysql时区相差8  14个小时show variables like "%time_zone%"set global time_zone = '+8:00'; ##修改mysql全局时区为北京时间,即我们所在的东8区set time_zone = '+8:00'; ##修改当前会话时区flush privileges; #立即生效

数据库同步

原创粉丝点击