脚本执行结束后,需要执行. /etc/profile.d/mysql.sh重读下配置文件。阿拉有尝试把这条命令添加到脚本里,但因为脚本执行是子进程,所以脚本结束后,PATH变量的值其实还没有更新。
记得执行. /etc/profile.d/mysql.sh哦。否则会出现以下报错哦。
[root@CentOS6 ~]# mysql
-bash: mysql: command not found
当然,重读配置文件后我们的基础环境就算配置好了。再执行mysql就不能匿名登录的,正确示例如下。
[root@CentOS6 ~]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: N
[root@CentOS6 ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 5.5.57-MariaDB MariaDB Server
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> quit
Bye阿拉给默认密码设置为www.ardusty.com了,有需要的可以直接修改脚本里倒数第二行的代码。当然也可以执行数据库命令修改密码。那又是另一个大知识了。
www.ardusty.com是阿拉的个人网站,目前正在建设中。。请先期待一下吧。哈哈。
好了,这次就是这样了。加纳。