./bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
缺少libaio.so 文件 对此文件进行安装
1
2
yum search libaio #查询文件
yum install libaio #安装文件
之后执行上面安装命令
1
2
3
4
5
6
2016-09-08T06:34:35.215617Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-09-08T06:34:37.175558Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-09-08T06:34:37.456478Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-09-08T06:34:37.529873Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 505a95f7-758e-11e6-a966-00163e0368de.
2016-09-08T06:34:37.531971Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-09-08T06:34:37.534742Z 1 [Note] A temporary password is generated for root@localhost: b/:q5Dd&mo-v
牢记上面的随机密码, 如上b/:q5Dd&mo-v, 下面我们修改密码时需要用到。
PS.如果你的data文件有内容 会报
[ERROR] --initialize specified but the data directory has files in it. Aborting.
这个错误 正确的是把data文件清空 rm -rf *
5.之后我们运行一下
cd /home/mysql
/support-files/mysql.server start
之后你会收到如下错误
./support-files/mysql.server: line 276: cd: /usr/local/mysql: No such file or directory
Starting MySQLCouldn't find MySQL server (/usr/local/mysql/[FAILED]ld_safe)
mysql> \s
--------------
mysql Ver 14.14 Distrib 5.7.9, for linux-glibc2.5 (x86_64) using EditLine wrapper
Connection id: 2
Current database: mysql
Current user: root@
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.7.9 MySQL Community Server (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /tmp/mysql.sock
Uptime: 4 min 47 sec
Threads: 1 Questions: 43 Slow queries: 0 Opens: 127 Flush tables: 1 Open tables: 122 Queries per second avg: 0.149--------------
# service mysqld startStarting MySQL SUCCESS!
[iyunv@localhost bin]# mysql -uroot -pEnter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3Server version: 5.7.9Copyright (c) 2000,
2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates.
Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use mysql;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement
before executing this statement.
mysql > exit;
Bye
# cd /home/mysql# ./bin/mysqladmin -u root -p passwordEnter password:
New password:
Confirm new password:
Warning: Since password will be sent to server in plain text, use ssl connection to
ensure password safety.# mysql -uroot -pEnter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6Server version: 5.7.9 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates.
Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
mysqladmin: [Warning] Using a password on the command line interface can be insecure.Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.1234
其中,
1
b/:q5Dd&mo-v
就是我们在使用mysqld --initialize时牢记下的随机密码
11. mysql远程授权
格式如下:
1
mysql> grant all [privileges] on db_name.table_name to 'username'@'host' identified by 'password';
示例如下:
1
2
3
mysql> grant all privileges on *.* to 'root'@'%' identified by '123456';