1、安装mysql使用make -j 4的时候报错
Linking CXX static library ../../archive_output_directory/libmysqlpump_lib.a
[ 83%] Built target mysqlpump_lib
[ 83%] Building CXX object sql/CMakeFiles/sql.dir/item_geofunc_relchecks_bgwrap.cc.o
c++: Internal error: Killed (program cc1plus)
Please submit a full bug report.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
make[2]: *** [sql/CMakeFiles/sql.dir/item_geofunc.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/server/mysql-5.7.27/sql/item_geofunc_relchecks_bgwrap.cc: In static member function ‘static int BG_wrap<Geom_types>::multipoint_disjoint_multi_geometry(const typename Geom_types::Multipoint&, const Geom_type&) [with Geom_type = Gis_multi_polygon, Geom_types = BG_models<boost::geometry::cs::cartesian>]’:
/server/mysql-5.7.27/sql/item_geofunc_relchecks_bgwrap.cc:545: warning: ‘box.boost::geometry::model::box<boost::geometry::model::point<double, 2ul, boost::geometry::cs::cartesian> >::m_max_corner.boost::geometry::model::point<double, 2ul, boost::geometry::cs::cartesian>::m_values[1ul]’ may be used uninitialized in this function
At global scope:
cc1plus: warning: unrecognized command line option "-Wno-unused-local-typedefs"
make[1]: *** [sql/CMakeFiles/sql.dir/all] Error 2
make: *** [all] Error 2
[root@lazyDog mysql-5.7.27]#
总结:
网上搜了一下,出现该错误是因为内存不够。增加内存即可正常安装mysql
安装mysql的make -j 4的时候,差不多需要消耗6GB的内存 (原先才4Gb)
2、(本实验安装的是boost1_59。如果用其他版本安装的时候会报错,其原因可能是gcc版本过低)
3、cmake的参数要写对,不然会影响启动
cmake -DCMAKE_INSTALL_PREFIX=/server/mysql \
-DMYSQL_DATADIR=/server/mysql/data \
-DSYSCONFDIR=/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/server/mysql/mysql.sock \ (当初写成了 /server/mysq)
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=/server/boost
**********************************************************
-DMYSQL_UNIX_ADDR=/server/mysql/mysql.sock \ (当初写成了 /server/mysq)
安装完输入mysql的指令会报错:
由于当时cmake的参数写错了,只能完全卸载mysql再次安装。
需要注意的是 my-default.cnf 和 /etc/my.cnf配置如下。 要跟cmake的 socket文件路径一致 (默认是存在 /var下面的)
下面是 my.cnf的配置内存:
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
basedir = /server/mysql
datadir = /server/mysql/data
port = 3306
socket = /server/mysql/mysql.sock
character-set-server=utf8
back_log = 300
max_connections = 3000
max_connect_errors = 50
table_open_cache = 4096
max_allowed_packet = 32M
#binlog_cache_size = 4M
max_heap_table_size = 128M
read_rnd_buffer_size = 16M
sort_buffer_size = 16M
join_buffer_size = 16M
thread_cache_size = 16
query_cache_size = 128M
query_cache_limit = 4M
ft_min_word_len = 8
thread_stack = 512K
transaction_isolation = REPEATABLE-READ
tmp_table_size = 128M
#log-bin=mysql-bin
long_query_time = 6
server_id=1
innodb_buffer_pool_size = 1G
innodb_thread_concurrency = 16
innodb_log_buffer_size = 16M
innodb_log_file_size = 512M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_file_per_table = on
[mysqldump]
quick
max_allowed_packet = 32M
[mysql]
no-auto-rehash
default-character-set=utf8
socket = /server/mysql/mysql.sock
safe-updates
[myisamchk]
key_buffer = 16M
sort_buffer_size = 16M
read_buffer = 8M
write_buffer = 8M
[mysqlhotcopy]
interactive-timeout
[mysqld_safe]
open-files-limit = 8192
[client]
socket = /server/mysql/mysql.sock
4、linux解决 Can 't connect to local MySQL server through socket'/tmp/mysql.sock '(2)";
解决方法:加上权限777。最后就能正常运行了
参考该博客
linux解决 Can 't connect to local MySQL server through socket'/tmp/mysql.sock '(2)";_git1314的博客-CSDN博客
5、centos7 的mysql5.7的ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
安装的包的是mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz
处理方法:service mysql restart 。
检查有没有生成 mysql.pid文件 。 (对应配置是在my.cnf里面对应)
只要mysql -uroot -p 连上后,mysql.sock是会自动生成的