ch02 - MySQL安全相关配置
设置MySQL管理员账号密码 在安装MySQL数据库后,MySQL管理员的账号root密码默认为空,极不安全 启动修改丢失的MySQL单实例root密码方法 停止MySQL bash 1 /etc/init.d/mysqld stop 使用 –skip-grant-tables启动mysql,忽略授权登陆验证 bash 1 2 3 4 5 6 7 8 9 10 11 # 单实例 /app/mysql/bin/mysqld_safe --skip-grant-tables --user=mysql # 多实例 /app/mysql/bin/mysqld_safe --defaults-file=/data/3306/my.cnf --user=mysql --skip-grant-tables & # 登录时空密码 $ mysql -S /data/3306/mysql.sock ... ... Welcome to the MySQL monitor. Commands end with ; or \g. # 在启动时加 --skip-grant-tables参数,表示忽略授权 修改root密码为新密码 bash 1 2 3 4 5 6 mysql> set password=password('123'); ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement mysql> update mysql....