MySQL登录时缺少my.cnf文件(源码安装5.7时出现的一个问题没有my.cnf)无法登陆

参考https://blog.csdn.net/djcode/article/details/78621772

错误 /etc/my.cnf 下没有此文件my.cnf

解决方法

killall mysqldd 杀死所有占有MySQL的进程

/usr/local/mysql/bin/mysqld_safe --user=mysql &            启动mysql

/usr/local/mysql/bin/mysql -uroot -p"d)a6,I2nFVYS"          登录       引号里是密码

如果还无法解决,只能继续游览了

 


修改源码mysql的启动方式
[root@localhost support-files]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqldd
[root@localhost support-files]# service mysqldd restart
开机自启动
[root@localhost support-files]# chkconfig --add mysqldd
[root@localhost support-files]# chkconfig mysqldd on
也可以
[root@localhost support-files]# systemctl restart mysqldd

修改源码客户端
[root@localhost support-files]# vim /etc/profile
PATH=/usr/local/mysql/bin:$PATH
export PATH

[root@localhost support-files]# source /etc/profile
测试登录
[root@localhost support-files]# mysql -u root -p“ 123”     登录

你可能感兴趣的:(Linux,shell)