前言:
而今朋友们对“centos重启mysql命令”都比较注意,我们都想要学习一些“centos重启mysql命令”的相关内容。那么小编在网络上搜集了一些有关“centos重启mysql命令””的相关知识,希望各位老铁们能喜欢,看官们快快来了解一下吧!查看centos版本:cat /etc/redhat-releasemysql8安装:wget -ivh mysql80-community-release-el7-7.noarch.rpmyum -y install mysql-server查看初始密码:cat /var/log/mysqld.log登录mysql命令:mysql -uroot -p输入初始密码修改密码:ALTER USER 'root'@'localhost' IDENTIFIED BY '新密码';修改配置文件:vim /etc/my.cnf 去掉#号:disable_log_bin参数 ,这个参数一般需要启用,这样可以减少磁盘的日志输入如果需要远程连接,第一步确定服务器有没有打开3306端口,第二步:进入mysql命令中,输入:SELECT User, Host FROM mysql.user;如果root host是localhost,说明mysql禁止root远程访问,需要重新设置host 输入命令:CREATE USER 'root'@'%' IDENTIFIED BY '123_abcABC_456'; 和GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';更新配置命令:FLUSH PRIVILEGES;查看是否生效:SELECT User, Host FROM mysql.user;常用命令:重新加载 systemctl daemon-reload启动systemctl start mysqld.service重启systemctl restart mysqld.service停止systemctl stop mysqld.service查看启动状态systemctl status mysqld.service加入开机启动systemctl enable mysqld.service取消开机启动systemctl disable mysqld.service