时间:2021-07-01 10:21:17 帮助过:17人阅读
shell>tar -zxvf mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz -C /usr/local/ shell>mv mysql-5.7.20-linux-glibc2.12-x86_64/ mysql shell> groupadd mysql shell> useradd -r -g mysql -s /bin/false mysql shell> cd /usr/local shell> cd mysql shell> mkdir mysql-files shell> chmod 750 mysql-files shell> chown -R mysql . shell> chgrp -R mysql . shell> bin/mysqld --initialize --user=mysql //这个命令执行完之后会出现默认密码如下图:
[root@10-23-52-37 mysql]# bin/mysqld --initialize -user=mysql bin/mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory
solution(http://blog.csdn.net/sbwfgihc/article/details/16880813):
[root@10-23-52-37 bin]# ./mysqld --initialize --user=mysql ./mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory [root@10-23-52-37 bin]# [root@10-23-52-37 bin]# [root@10-23-52-37 bin]# [root@10-23-52-37 bin]# yum remove libnuma.so.1 Loaded plugins: fastestmirror Setting up Remove Process No Match for argument: libnuma.so.1 Loading mirror speeds from cached hostfile No Packages marked for removal [root@10-23-52-37 bin]# [root@10-23-52-37 bin]# [root@10-23-52-37 bin]# yum install numactl.x86_64 Loaded plugins: fastestmirror Setting up Install Process Loading mirror speeds from cached hostfile Resolving Dependencies --> Running transaction check ---> Package numactl.x86_64 0:2.0.9-2.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================================== Package Arch Version Repository Size ============================================================================================================================================================================================== Installing: numactl x86_64 2.0.9-2.el6 base 74 k Transaction Summary ============================================================================================================================================================================================== Install 1 Package(s) Total download size: 74 k Installed size: 171 k Is this ok [y/N]: y Downloading Packages: numactl-2.0.9-2.el6.x86_64.rpm | 74 kB 00:00 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : numactl-2.0.9-2.el6.x86_64 1/1 Verifying : numactl-2.0.9-2.el6.x86_64 1/1 Installed: numactl.x86_64 0:2.0.9-2.el6 Complete! [root@10-23-52-37 bin]# [root@10-23-52-37 bin]# [root@10-23-52-37 bin]# [root@10-23-52-37 bin]# ./mysqld --initialize --user=mysql 2018-01-06T05:56:09.780808Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2018-01-06T05:56:10.442494Z 0 [Warning] InnoDB: New log files created, LSN=45790 2018-01-06T05:56:10.641425Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2018-01-06T05:56:10.709560Z 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: 4bba7d6e-f2a6-11e7-96fb-525400cb5213. 2018-01-06T05:56:10.711979Z 0 [Warning] Gtid table is not ready to be used. Table ‘mysql.gtid_executed‘ cannot be opened. 2018-01-06T05:56:10.713290Z 1 [Note] A temporary password is generated for root@localhost: L9&X;A(t+6ju [root@10-23-52-37 bin]#
[root@10-23-52-37 bin]# ./mysql_ssl_rsa_setup Generating a 2048 bit RSA private key ..................................................................................................................................................................+++ ........................+++ writing new private key to ‘ca-key.pem‘ ----- Generating a 2048 bit RSA private key ........................................................................................................................................................+++ ..........................................................................................+++ writing new private key to ‘server-key.pem‘ ----- Generating a 2048 bit RSA private key ......+++ .......................................................................+++ writing new private key to ‘client-key.pem‘ ----- [root@10-23-52-37 bin]#
[root@10-23-52-37 mysql]# ls -ltr total 60 -rw-r--r-- 1 mysql mysql 2478 Sep 13 23:48 README -rw-r--r-- 1 mysql mysql 17987 Sep 13 23:48 COPYING drwxr-xr-x 3 mysql mysql 4096 Jan 6 10:42 include drwxr-xr-x 4 mysql mysql 4096 Jan 6 10:43 man drwxr-xr-x 2 mysql mysql 4096 Jan 6 10:43 bin drwxr-xr-x 5 mysql mysql 4096 Jan 6 10:43 lib drwxr-xr-x 2 mysql mysql 4096 Jan 6 10:43 support-files drwxr-xr-x 28 mysql mysql 4096 Jan 6 10:43 share drwxr-xr-x 2 mysql mysql 4096 Jan 6 10:43 docs drwxr-x--- 2 mysql mysql 4096 Jan 6 13:50 mysql-files drwxr-xr-x 5 mysql mysql 4096 Jan 6 13:59 data [root@10-23-52-37 mysql]# [root@10-23-52-37 mysql]# chown -R root . [root@10-23-52-37 mysql]# ls -ltr total 60 -rw-r--r-- 1 root mysql 2478 Sep 13 23:48 README -rw-r--r-- 1 root mysql 17987 Sep 13 23:48 COPYING drwxr-xr-x 3 root mysql 4096 Jan 6 10:42 include drwxr-xr-x 4 root mysql 4096 Jan 6 10:43 man drwxr-xr-x 2 root mysql 4096 Jan 6 10:43 bin drwxr-xr-x 5 root mysql 4096 Jan 6 10:43 lib drwxr-xr-x 2 root mysql 4096 Jan 6 10:43 support-files drwxr-xr-x 28 root mysql 4096 Jan 6 10:43 share drwxr-xr-x 2 root mysql 4096 Jan 6 10:43 docs drwxr-x--- 2 root mysql 4096 Jan 6 13:50 mysql-files drwxr-xr-x 5 root mysql 4096 Jan 6 13:59 data [root@10-23-52-37 mysql]#
[root@10-23-52-37 mysql]# bin/mysqld_safe --user=mysql & [1] 8148 [root@10-23-52-37 mysql]# Logging to ‘/usr/local/mysql/data/10-23-52-37.err‘. 2018-01-06T06:01:23.479595Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data 2018-01-06T06:01:24.218467Z mysqld_safe mysqld from pid file /usr/local/mysql/data/10-23-52-37.pid ended ^C [1]+ Done bin/mysqld_safe --user=mysql [root@10-23-52-37 mysql]#
shell> bin/mysql_ssl_rsa_setup # MySQL 5.7.6 and up shell> chown -R root . shell>bin/mysqld_safe --user=mysql & //(坑)执行这步的是为了生成pid,当你看到以.pid ended结尾,就可以ctrl+c,而且这一步mysql已经启动了,你需要执行ps -ef|grep mysqld,然后将mysql进程kill掉,然后在进行一下命令 shell>cd .. shell> sudo support-files/mysql.server start //开启mysql,他会报错,需要修改/etc/my.cnf下的socket=/tmp/mysql.sock,修改完成后再次启动mysql shell> cp support-files/mysql.server /etc/init.d/mysql.server//设置开机启动
[root@10-23-52-37 mysql]# support-files/mysql.server start Starting MySQL.Logging to ‘/usr/local/mysql/data/10-23-52-37.err‘. ERROR! The server quit without updating PID file (/usr/local/mysql/data/10-23-52-37.pid). [root@10-23-52-37 mysql]#
[root@10-23-52-37 mysql]# [root@10-23-52-37 mysql]# chown -R mysql.mysql /usr/local/mysql/data/ [root@10-23-52-37 mysql]# [root@10-23-52-37 mysql]# [root@10-23-52-37 mysql]# pwd /usr/local/mysql [root@10-23-52-37 mysql]# [root@10-23-52-37 mysql]# support-files/mysql.server start Starting MySQL.Logging to ‘/usr/local/mysql/data/10-23-52-37.err‘. SUCCESS! [root@10-23-52-37 mysql]#
[root@10-23-52-37 bin]# ./mysql ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO) [root@10-23-52-37 bin]# ./mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.7.20 Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement. mysql> status ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. mysql> mysql> mysql> mysql> set PASSWORD=PASSWORD(‘123qwe!@#QWE‘) -> ; Query OK, 0 rows affected, 1 warning (0.01 sec) mysql>
http://blog.csdn.net/Suubyy/article/details/78274070?locationNum=8&fps=1
ucloud mysql
标签:safe error: /etc sock chown val logging temp client