狗子的 狗子的
关注数: 52 粉丝数: 329 发帖数: 4,908 关注贴吧数: 64
centos7 安装mariadb yum 安装完成后报错 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 各种尝试未果 各种尝试mysql相关命令 都不行 ,什么service mysqld start了 什么的 各种不行 最后: systemctl status mariadb.service 发现mariadb 是inactive(dead) 遂 systemctl start mariadb.service 再次执行mysql 直接进去了mariadb的控制台 这样还不是很对 得搞个用户出来啊 不能谁都能登录啊 输入mysqladmin 会输出一堆 Variables (--variable-name=value) and boolean options {FALSE|TRUE} Value (after reading options) --------------------------------- ---------------------------------------- count 0 debug-check FALSE debug-info FALSE force FALSE compress FALSE character-sets-dir (No default value) default-character-set auto host (No default value) no-beep FALSE port 0 relative FALSE socket (No default value) sleep 0 ssl FALSE ssl-ca (No default value) ssl-capath (No default value) ssl-cert (No default value) ssl-cipher (No default value) ssl-key (No default value) ssl-verify-server-cert FALSE user root verbose FALSE vertical FALSE connect-timeout 43200 shutdown-timeout 3600 plugin-dir (No default value) default-auth (No default value) Where command is a one or more of: (Commands may be shortened) create databasename Create a new database debug Instruct server to write debug information to log drop databasename Delete a database and all its tables extended-status Gives an extended status message from the server flush-all-statistics Flush all statistics tables flush-all-status Flush status and statistics flush-client-statistics Flush client statistics flush-hosts Flush all cached hosts flush-index-statistics Flush index statistics flush-logs Flush all logs flush-privileges Reload grant tables (same as reload) flush-slow-log Flush slow query log flush-status Clear status variables flush-table-statistics Clear table statistics flush-tables Flush all tables flush-threads Flush the thread cache flush-user-statistics Flush user statistics kill id,id,... Kill mysql threads password [new-password] Change old password to new-password in current format old-password [new-password] Change old password to new-password in old format ping Check if mysqld is alive processlist Show list of active threads in server reload Reload grant tables refresh Flush all tables and close and open logfiles shutdown Take server down status Gives a short status message from the server start-slave Start slave stop-slave Stop slave variables Prints variables available version Get version info from server ---------------------------------------------------------------------------- 输出上面一堆 看到了user root 然后看到了命令是一个或多个下面指令 又看到了password命令 change 老密码到新密码 然后就 mysqladmin password 123456 然后就可以 mysql尝试登录了 输入mysql 返回 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 说明密码设置成功了 mysql -u root -p 123456 登录成功 睡觉了~~~
1 下一页