因为本人之前没有使用过centos,这回只是搭建一个centos的环境来测试我的站点,安装my的时候就遇到了很多问题,
1.安装mysql后发现启动不了:报如下错误
# systemctl start mysql Failed to issue method call: Unit mysql.service failed to load: No such file or directory.
# systemctl start mysql.service Failed to issue method call: Unit mysql.service failed to load: No such file or directory
# systemctl enable mysql.service Failed to issue method call: Access denied
最后发现是因为没有安装 mariadb-server 导致的,解决如下:
# yum install mariadb-server -y
# systemctl start mariadb.service
# systemctl enable mariadb.service
# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 10 Server version: 5.5.44-MariaDB MariaDB Server Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
如何设置mysql root密码
# mysql_secure_installation,
然后随即的就是第二个问题,输入这些,它会让你输入root的密码,来确定,然后你才能修改密码,但是哥们装的时候你丫也没让我输入密码,这下完蛋了,解决的方法:
总结几个知识:
查看安装的服务(软件)
rpm –qa|grep -i mysql -i 作用是不区分大小写
卸载服务(软件)
rpm –e 服务名称