mysql下载https://downloads.mysql.com/archives/community/
安装文档https://dev.mysql.com/doc/refman/5.7/en/installing-source-distribution.html
遇到问题:
CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
yum install gcc-c++
CMake Error at cmake/boost.cmake:88 (MESSAGE): You can download it with -DDOWNLOAD_BOOST=1 -DWITH_BOOST=<directory>
下载https://www.boost.org/
Boost minor version found is 74 we need 59
下载对应的_59版本,可以通过cmake时自动安装
#安照cmake ..报错时提示的 cmake .. -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost_1_59
Make Error at cmake/ssl.cmake:63 (MESSAGE): Please install the appropriate openssl developer package
yum -y install openssl-devel
rm -f CMakeCache.txt
CMake Error at cmake/readline.cmake:71 (MESSAGE): Curses library not found. Please install appropriate package
yum install ncurses-devel.x86_64
# Preconfiguration setup shell> groupadd mysql shell> useradd -r -g mysql -s /bin/false mysql # Beginning of source-build specific instructions shell> tar zxvf mysql-VERSION.tar.gz shell> cd mysql-VERSION shell> mkdir bld shell> cd bld shell> cmake .. shell> make shell> make install # End of source-build specific instructions # Postinstallation setup shell> cd /usr/local/mysql shell> mkdir mysql-files shell> chown mysql:mysql mysql-files shell> chmod 750 mysql-files shell> bin/mysqld --initialize --user=mysql A temporary password is generated for root@localhost: M_ORdyr4uL+O shell> bin/mysql_ssl_rsa_setup shell> bin/mysqld_safe --user=mysql & # Next command is optional shell> cp support-files/mysql.server /etc/init.d/mysql.server
重置root密码
pkill mysql
/usr/local/mysql/bin/mysqld_safe --skip-grant-tables
新开终端/usr/local/mysql/bin/mysql -u root
连接时报错:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock
[client] port=3306 socket=/var/lib/mysql/mysql.sock#需要跟mysqld的socket路径一样
mysql>SET PASSWORD FOR 'root'@'localhost' = PASSWORD('');#mysql-8修改不需要加password(),直接明文如="123456"
mysql>/usr/local/mysql/bin/mysqld_safe --user=mysql &
wamp添加新版mysql8,添加之后启动不了查看错误wamp下的mysql错误日志提示,一开始是没有data目录,手动添加data目录时报错:Failed to find valid data directory. [ERROR] [MY-010020] [Server] Data Dictionary initialization failed,通过搜索发现需要使用mysqld自带的初始化自动生成的data目录才能使用,先手动删除data目录之后使用命令mysqld --initialize-insecure,完成data目录初始化后,mysqld --install ,安装mysqld服务,然后可以正常启动服务了
某天重启了linux服务器发现使用mysqld_safe启动不了了,查看日志需要根据/etc/my.cnf中配置在/var/run下新建myql目录,因为/var/run是tmpfs文件系统是基于内容的,每次重启服务后就消失了需要重新建立