a)为root用户设置密码
b)删除匿名账号
c)取消root用户远程登录
d)删除test库和对test库的访问权限
e)刷新授权表使修改生效 2).select user,host,password from mysql.user; delete from mysql.user where user != ‘root‘ ot host != ‘localhost‘; truncate table mysql.db drop database test; flush privileges; 9.关闭mysql /usr/local/mysql/bin/mysqladmin -S /tmp/mysql3376.sock shutdown ss -tnl | grep 3306 sock 是unix domain的一种通信方式 监听 我碰到的错误及解决办法: [root@mysqldb15 mysql]# ./scripts/mysql_install_db --defaults-file=/data/mysql/mysql3376/my3376.cnf WARNING: The host ‘mysqldb15‘ could not be looked up with /usr/local/mysql/bin/resolveip. This probably means that your libc libraries are not 100 % compatible with this binary MySQL version. The MySQL daemon, mysqld, should work normally with the exception that host name resolving will not work. This means that you should use IP addresses instead of hostnames when specifying MySQL privileges ! 这个错误应该是在/etc/hosts里面没有解析,解决方法: vi /etc/hosts 192.168.6.15 mysqldb15 Installing MySQL system tables...2016-03-31 14:50:18 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2016-03-31 14:50:18 0 [Note] ./bin/mysqld (mysqld 5.6.29-log) starting as process 6160 ... 缺少explicit_defaults_for_timestamp参数,加上即可 [root@localhost]# tail -f error3376.log 2016-03-31 15:00:16 6265 [Note] InnoDB: Using atomics to ref count buffer pool pages 2016-03-31 15:00:16 6265 [Note] InnoDB: The InnoDB memory heap is disabled 2016-03-31 15:00:16 6265 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2016-03-31 15:00:16 6265 [Note] InnoDB: Memory barrier is not used 2016-03-31 15:00:16 6265 [Note] InnoDB: Compressed tables use zlib 1.2.3 2016-03-31 15:00:16 6265 [Note] InnoDB: Using Linux native AIO 2016-03-31 15:00:16 6265 [Note] InnoDB: Not using CPU crc32 instructions 2016-03-31 15:00:16 6265 [Note] InnoDB: Initializing buffer pool, size = 1.0G 2016-03-31 15:00:16 6265 [Note] InnoDB: Completed initialization of buffer pool 2016-03-31 15:00:16 6265 [Note] InnoDB: Restoring page 0 of tablespace 0 2016-03-31 15:00:16 6265 [Warning] InnoDB: Doublewrite does not have page_no=0 of space: 0 2016-03-31 15:00:16 6265 [ERROR] InnoDB: space header page consists of zero bytes in data file ./ibdata1 2016-03-31 15:00:16 6265 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data! 2016-03-31 15:00:16 6265 [ERROR] Plugin ‘InnoDB‘ init function returned error. 2016-03-31 15:00:16 6265 [ERROR] Plugin ‘InnoDB‘ registration as a STORAGE ENGINE failed. 2016-03-31 15:00:16 6265 [ERROR] Unknown/unsupported storage engine: InnoDB 2016-03-31 15:00:16 6265 [ERROR] Aborting 2016-03-31 15:00:16 6265 [Note] Binlog end 2016-03-31 15:00:16 6265 [Note] ./bin/mysqld: Shutdown complete 删除data下面的数据,重新初始化 启动 && 登入: /usr/local/mysql/bin/mysqld --defaults-file=/data/mysql/mysql3306/my3306.cnf & mysql -uroot -p -S /tmp/mysql3306.sock 设置root密码: mysqladmin -u root password ‘123‘ 或者 mysql>set password for ‘root‘@‘localhost‘=password(‘123‘); mysql>flush privileges; 创建关闭用户: grant shutdown on *.* to admin@‘localhost‘ identified by ‘1234‘; flush privileges; mysqladmin -S /tmp/mysql3306.sock shutdown --user=amin --password=1234 或者 mysqladmin -S /tmp/mysql3306.sock shutdown --user=amin -p1234 设置开机启动,根据自己的需求:echo "/usr/local/mysql/bin/mysqld --defaults-file=/data/mysql/mysql3306/my3306.cnf &" >>/etc/rc.local 每次敲这些命令都太繁琐,我们可以将启动关闭写成相关脚本: 设置启动脚本:/usr/local/mysql/bin/mysqld --defaults-file=/data/mysql/mysql3306/my3306.cnf & 设置关机脚本:mysqladmin -S /tmp/mysql3306.sock shutdown --user=root--password=123 设置重启脚本:mysqladmin -S /tmp/mysql3306.sock shutdown --user=root --password=123 /usr/local/mysql/bin/mysqld --defaults-file=/data/mysql/mysql3306/my3306.cnf & 导入数据:mysql -uroot -p -S /tmp/mysql3306.sock < backup.sql
从零开始的MYSQL --- MySQL安装及环境部署
标签: