Mysql设置sql_mode失败

1.修改my.ini文件;
2.命令修改;
都修改不了。
Mysql 5.7.18

1个回答

mysql> set @@sql_mode ='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_F
OR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
网上有博客这样改的全局的mode,修改成功了

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
mysql5.7 sql_mode设置后的疑问
当我在MySQL命令行的客户端设置sql_mode后,my.cnf里并未指定sql_mode(也就是说之前是用的5.7的默认模式),退出客户端再连接进来时出现sql_mode为空的现象,见下图一和下图二,这是什么原因呢? 设置时: mysql> set @@GLOBAL.sql_mode=''; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> set sql_mode ='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; Query OK, 0 rows affected (0.00 sec) 重新连接后: mysql> select @@sql_mode; +------------+ | @@sql_mode | +------------+ | | +------------+ 1 row in set (0.00 sec)
mycat set session sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' is not recoginized and ignored
mycat 警告日志 set session sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' is not recoginized and ignored 是mycat不支持设置吗
phpmyadmin中导入mysql数据库时出现#1064的错误
静态分析: 分析时发现2个错误。 Unexpected beginning of statement. (near "phpMyAdmin" at position 0) Unrecognized statement type. (near "SQL" at position 11) SQL 查询: phpMyAdmin SQL DumpSET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO" MySQL 返回: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'phpMyAdmin SQL Dump SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"' at line 1 以上是错误的提示,求解决,谢谢啦!
搭建cacti服务器,在导入cacti.sql到MySQL时报错
搭建cacti服务器,在导入cacti.sql到MySQL时报错,过程如下: [tony@localhost cacti]mysql -u cacti -p cacti < /var/www/html/cacti/cacti.sql Enter password: ERROR 1231 (42000) at line 6: Variable 'sql_mode' can't be set to the value of 'NO_AUTO_CREATE_USER' MySQL版本是8.0.17. 请问此错误如何解决,谢谢各位。
mysql会话监控阻塞的sql
当mysql数据库中的表被我锁上几个后,为什么用这两个sql语句查不出被锁的表和被锁的个数,大神们有没有什么好的sql语句啊,求助!!! ``` SELECT p2.`HOST` 被阻塞方host, p2.`USER` 被阻塞方用户, r.trx_id 被阻塞方事务id, r.trx_mysql_thread_id 被阻塞方线程号, TIMESTAMPDIFF( SECOND, r.trx_wait_started, CURRENT_TIMESTAMP ) 等待时间, r.trx_query 被阻塞的查询, l.lock_table 阻塞方锁住的表, m.`lock_mode` 被阻塞方的锁模式, m.`lock_type` "被阻塞方的锁类型(表锁还是行锁)", m.`lock_index` 被阻塞方锁住的索引, m.`lock_space` 被阻塞方锁对象的space_id, m.lock_page 被阻塞方事务锁定页的数量, m.lock_rec 被阻塞方事务锁定行的数量, m.lock_data 被阻塞方事务锁定记录的主键值, p.`HOST` 阻塞方主机, p.`USER` 阻塞方用户, b.trx_id 阻塞方事务id, b.trx_mysql_thread_id 阻塞方线程号, b.trx_query 阻塞方查询, l.`lock_mode` 阻塞方的锁模式, l.`lock_type` "阻塞方的锁类型(表锁还是行锁)", l.`lock_index` 阻塞方锁住的索引, l.`lock_space` 阻塞方锁对象的space_id, l.lock_page 阻塞方事务锁定页的数量, l.lock_rec 阻塞方事务锁定行的数量, l.lock_data 阻塞方事务锁定记录的主键值, IF ( p.COMMAND = 'Sleep', CONCAT(p.TIME, ' 秒'), 0 ) 阻塞方事务空闲的时间 FROM information_schema.INNODB_LOCK_WAITS w INNER JOIN information_schema.INNODB_TRX b ON b.trx_id = w.blocking_trx_id INNER JOIN information_schema.INNODB_TRX r ON r.trx_id = w.requesting_trx_id INNER JOIN information_schema.INNODB_LOCKS l ON w.blocking_lock_id = l.lock_id AND l.`lock_trx_id` = b.`trx_id` INNER JOIN information_schema.INNODB_LOCKS m ON m.`lock_id` = w.`requested_lock_id` AND m.`lock_trx_id` = r.`trx_id` INNER JOIN information_schema.PROCESSLIST p ON p.ID = b.trx_mysql_thread_id INNER JOIN information_schema.PROCESSLIST p2 ON p2.ID = r.trx_mysql_thread_id; ``` ``` SELECT r.trx_id waiting_trx_id, r.trx_mysql_thread_Id waiting_thread, r.trx_query waiting_query, b.trx_id blocking_trx_id, b.trx_mysql_thread_id blocking_thread, b.trx_query blocking_query FROM information_schema.innodb_lock_waits w INNER JOIN information_schema.innodb_trx b ON b.trx_id = w.blocking_trx_id INNER JOIN information_schema.innodb_trx r ON r.trx_id = w.requesting_trx_id; ```
mysql 多源复制 ,多库多表合到一个库
mysql 多源复制 ,多库多表合到一个库,库名无法重新修改,配置文件如下: 【slave】 ``` [mysqld] user=mysql character-set-server=utf8mb4 default_authentication_plugin=mysql_native_password server_id=1006 replicate-ignore-db = mysql replicate-ignore-db = information_schema replicate-ignore-db = performance_schema replicate-ignore-db = sys #read_only=1 replicate-do-db=mass replicate-rewrite-db=zdbtest->mass relay-log =mysqld-relay-bin log-slave-updates = ON slave-parallel-type=LOGICAL_CLOCK relay_log_recovery=ON slave_net_timeout = 30 slave_parallel_workers = 16 #slave-skip-errors = all #slave-skip-errors = 1062,1053,1146,1213,1264,1205,1396 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES master_info_repository=TABLE relay_log_info_repository=TABLE gtid-mode=on enforce-gtid-consistency=true plugin-load=rpl_semi_sync_slave=semisync_slave.so rpl_semi_sync_slave_enabled=1 [client] default-character-set=utf8mb4 [mysql] default-character-set=utf8mb4 ``` ## [master] ``` [mysqld] user=mysql character-set-server=utf8mb4 default_authentication_plugin=mysql_native_password server-id=1003 log-bin=mysql-bin binlog-format=MIXED binlog-ignore-db=mysql binlog-ignore-db=information_schema binlog-ignore-db=performance_schema binlog-ignore-db=sys sync_binlog=1 auto_increment_increment=2 auto_increment_offset=1 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES gtid-mode=on enforce-gtid-consistency=true master_info_repository=TABLE relay_log_info_repository=TABLE plugin-load=rpl_semi_sync_master=semisync_master.so rpl_semi_sync_master_enabled=1 ## [client] default-character-set=utf8mb4 [mysql] default-character-set=utf8mb4 ``` 帮忙看看有什么问题没有???
请教mysql5.6免安装版无法修改character_set_server的value的问题
各位大神好,我在使用mysql5.6免安装版时查看字符集时: ![图片说明](https://img-ask.csdn.net/upload/201704/29/1493474915_830538.png) 而此时我的my.ini配置文件为: ``` [mysqld] basedir = C:\Program Files\Mysql datadir = C:\Program Files\Mysql\data port = 3306 character_set_server=utf8 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES [client] port=3306 default-character-set=utf8 [mysql] default-character-set=utf8 ``` 很奇怪我的得字符集并没有生效啊 查了很多都是跟我的配置无差啊,特来请教!
mysql语法问题,哪位能帮我一下,谢谢
SELECT MTAUT_ID,MTAUT_NAME,MTAUT_PARID,MTAUT_INDEX FROM MT005AUT GROUP BY MTAUT_PARID,MTAUT_INDEX DESC 想用group by分组排序 报错,Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'mtiansystem.MT005AUT.MTAUT_ID' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
A mysql problem. Help me!
why these statements are wrong ? these statements are auto generated by mysql workbench -- MySQL Workbench Forward Engineering SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; -- ----------------------------------------------------- -- Schema SysBaseData -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema SysBaseData -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `SysBaseData` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ; SHOW WARNINGS; USE `SysBaseData` ; -- ----------------------------------------------------- -- Table `SysBaseData`.`Instruments` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `SysBaseData`.`Instruments` ( `InstrumentID` CHAR(32) NOT NULL, `ExchangeID` CHAR(12) NOT NULL, `InstrumentName` CHAR(24) NULL, PRIMARY KEY (`InstrumentID`, `ExchangeID`)) ENGINE = InnoDB; SHOW WARNINGS; -- ----------------------------------------------------- -- Table `SysBaseData`.`OrdersGroups` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `SysBaseData`.`OrdersGroups` ( `OrderGroup` INT NOT NULL, `OrderRef` CHAR(16) NOT NULL, `TradingDay` DATE NOT NULL, PRIMARY KEY (`OrderRef`, `TradingDay`, `OrderGroup`)) ENGINE = InnoDB; SHOW WARNINGS; -- ----------------------------------------------------- -- Table `SysBaseData`.`ErrorOrderRecords` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `SysBaseData`.`ErrorOrderRecords` ( `InstrumentID` CHAR(32) NULL, `ExchangeID` CHAR(12) NULL, `OrderPriceType` CHAR NULL, `Direction` CHAR NULL, `LimitPrice` CHAR(16) NULL, `VolumeTotalOriginal` INT NULL, `ErrorMsg` CHAR(255) NULL, `OrderGroup` INT NOT NULL, `OrderRef` CHAR(16) NOT NULL, `TradingDay` DATE NOT NULL, PRIMARY KEY (`TradingDay`, `OrderRef`, `OrderGroup`), CONSTRAINT `fk_ErrorOrderRecords_1` FOREIGN KEY (`TradingDay` , `OrderRef` , `OrderGroup`) REFERENCES `SysBaseData`.`OrdersGroups` (`TradingDay` , `OrderRef` , `OrderGroup`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; SHOW WARNINGS; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
mysql InnoDB: Error: "mysql"."innodb_table_stats
附上错误日志: 2015-06-23 22:39:06 1252 [Note] Giving 0 client threads a chance to die gracefully 2015-06-23 22:39:06 1252 [Note] Shutting down slave threads 2015-06-23 22:39:06 1252 [Note] Forcefully disconnecting 0 remaining clients 2015-06-23 22:39:06 1252 [Note] Binlog end 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'partition' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'BLACKHOLE' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_SYS_FIELDS' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_SYS_INDEXES' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_SYS_TABLES' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_FT_CONFIG' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_FT_DELETED' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_METRICS' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_CMPMEM' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_CMP_RESET' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_CMP' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_LOCK_WAITS' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_LOCKS' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'INNODB_TRX' 2015-06-23 22:39:09 1252 [Note] Shutting down plugin 'InnoDB' 2015-06-23 22:39:09 1252 [Note] InnoDB: FTS optimize thread exiting. 2015-06-23 22:39:09 1252 [Note] InnoDB: Starting shutdown... 2015-06-23 22:39:12 1252 [Note] InnoDB: Shutdown completed; log sequence number 44832642 2015-06-23 22:39:12 1252 [Note] Shutting down plugin 'ARCHIVE' 2015-06-23 22:39:12 1252 [Note] Shutting down plugin 'MyISAM' 2015-06-23 22:39:12 1252 [Note] Shutting down plugin 'CSV' 2015-06-23 22:39:12 1252 [Note] Shutting down plugin 'MRG_MYISAM' 2015-06-23 22:39:12 1252 [Note] Shutting down plugin 'MEMORY' 2015-06-23 22:39:12 1252 [Note] Shutting down plugin 'sha256_password' 2015-06-23 22:39:12 1252 [Note] Shutting down plugin 'mysql_old_password' 2015-06-23 22:39:12 1252 [Note] Shutting down plugin 'mysql_native_password' 2015-06-23 22:39:12 1252 [Note] Shutting down plugin 'binlog' 2015-06-23 22:39:12 1252 [Note] /usr/sbin/mysqld: Shutdown complete 150623 22:39:12 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended 150623 22:39:39 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 2015-06-23 22:39:39 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2015-06-23 22:39:39 1190 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000) 2015-06-23 22:39:39 1190 [Warning] Buffered warning: Changed limits: table_cache: 431 (requested 2000) 2015-06-23 22:39:39 1190 [Note] Plugin 'FEDERATED' is disabled. 2015-06-23 22:39:39 1190 [Note] InnoDB: Using atomics to ref count buffer pool pages 2015-06-23 22:39:39 1190 [Note] InnoDB: The InnoDB memory heap is disabled 2015-06-23 22:39:39 1190 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2015-06-23 22:39:39 1190 [Note] InnoDB: Memory barrier is not used 2015-06-23 22:39:39 1190 [Note] InnoDB: Compressed tables use zlib 1.2.3 2015-06-23 22:39:39 1190 [Note] InnoDB: Using Linux native AIO 2015-06-23 22:39:39 1190 [Note] InnoDB: Not using CPU crc32 instructions 2015-06-23 22:39:39 1190 [Note] InnoDB: Initializing buffer pool, size = 1.0G 2015-06-23 22:39:40 1190 [Note] InnoDB: Completed initialization of buffer pool 2015-06-23 22:39:40 1190 [Note] InnoDB: Highest supported file format is Barracuda. 2015-06-23 22:39:40 1190 [Note] InnoDB: 128 rollback segment(s) are active. 2015-06-23 22:39:40 1190 [Note] InnoDB: Waiting for purge to start 2015-06-23 22:39:40 1190 [Note] InnoDB: 5.6.22 started; log sequence number 44832642 2015-06-23 22:39:41 1190 [Note] Server hostname (bind-address): '*'; port: 3306 2015-06-23 22:39:41 1190 [Note] IPv6 is available. 2015-06-23 22:39:41 1190 [Note] - '::' resolves to '::'; 2015-06-23 22:39:41 1190 [Note] Server socket created on IP: '::'. 2015-06-23 22:39:41 1190 [ERROR] Incorrect definition of table mysql.db: expected column 'User' at position 2 to have type char(16), found type char(80). 2015-06-23 22:39:41 1190 [ERROR] Incorrect definition of table mysql.event: expected column 'definer' at position 3 to have type char(77), found type char(141). 2015-06-23 22:39:41 1190 [ERROR] Incorrect definition of table mysql.event: expected column 'sql_mode' at position 14 to have type set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH'), found type set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_A 2015-06-23 22:39:41 1190 [ERROR] Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler. 2015-06-23 22:39:41 1190 [Note] /usr/sbin/mysqld: ready for connections. Version: '5.6.22' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL) 2015-06-23 23:00:47 7f7038bc0700 InnoDB: Error: Column last_update in table "mysql"."innodb_table_stats" is INT UNSIGNED NOT NULL but should be BINARY(4) NOT NULL (type mismatch). 2015-06-23 23:00:47 7f7038bc0700 InnoDB: Error: Fetch of persistent statistics requested for table "moodle"."mdl_config" but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have unexpected structure. Using transient stats instead.
php测试mysql类失败,哪里错了?
运行index.php时一片空白,什么提示都没有;调试时发现mysql类中的select_db($db) 方法和后面的都未得到执行 大神帮忙看看 ,谢谢! ``` <?php //数据库类 class mysql extends db { private static $ins = NULL; private $conn = NULL; private $conf = array(); protected function __construct() { $this->conf = conf::getIns(); $this->connect($this->conf->host,$this->conf->user,$this->conf->pwd); $this->select_db($this->conf->db); $this->setChar($this->conf->char); } public function __destruct() { } public static function getIns() { if(!(self::$ins instanceof self)) { self::$ins = new self(); } return self::$ins; } public function connect($h,$u,$p) { $this->conn =@mysql_connect($h,$u,$p); if(!$this->conn) { $err = new Exception('连接失败'); throw $err; } } protected function select_db($db) { $sql = 'use '.$db; $this->query($sql); } protected function setChar($char) { $sql = 'set names ' . $char; return $this->query($sql); } public function query($sql) { $rs = mysql_query($sql,$this->conn); log::write($sql); return $rs; } public function autoExecute($table,$arr,$mode='insert',$where = ' where 1 limit 1') { /* insert into tbname (username,passwd,email) values ('',) /// 把所有的键名用','接起来 // implode(',',array_keys($arr)); // implode("','",array_values($arr)); */ if(!is_array($arr)) { return false; } if($mode == 'update') { $sql = 'update ' . $table .' set '; foreach($arr as $k=>$v) { $sql .= $k . "='" . $v ."',"; } $sql = rtrim($sql,','); $sql .= $where; return $this->query($sql); } $sql = 'insert into ' . $table . ' (' . implode(',',array_keys($arr)) . ')'; $sql .= ' values (\''; $sql .= implode("','",array_values($arr)); $sql .= '\')'; return $this->query($sql); } public function getAll($sql) { $rs = $this->query($sql); $list = array(); while($row = mysql_fetch_assoc($rs)) { $list[] = $row; } return $list; } public function getRow($sql) { $rs = $this->query($sql); return mysql_fetch_assoc($rs); } public function getOne($sql) { $rs = $this->query($sql); $row = mysql_fetch_row($rs); return $row[0]; } // 返回影响行数的函数 public function affected_rows() { return mysql_affected_rows($this->conn); } // 返回最新的auto_increment列的自增长的值 public function insert_id() { return mysql_insert_id($this->conn); } } ``` ``` <?php //file:index.php 首页面 //所有用户直接访问到的这些页面必须先加载init.php require('./include/init.php'); //测试数据库 $mysql=mysql::getIns(); var_dump($mysql); ``` ``` <?php //配置文件 $_CFG=array(); $_CFG['host']='locallhost'; $_CFG['user']='root'; $_CFG['pwd']='hooray'; $_CFG['db'] = 'boolshop'; $_CFG['char'] = 'utf8'; ?> ``` ``` <?php /** file:conf.class.php 配置文件读取类 **/ class conf{ protected static $ins=null; protected $data=array(); final protected function __construct(){ //一次性配置文件信息,赋给data include(ROOT.'include/config.inc.php'); $this->data=$_CFG; } final protected function __clone(){ } public static function getIns(){ if(self::$ins instanceof self){ return self::$ins; } else{ self::$ins=new self(); return self::$ins; } } // 用魔术方法获取data信息 public function __get($key){ if(array_key_exists($key,$this->data)){ return $this->data[$key]; }else{ return null; } } //用魔术方法,在运行时动态添加和更改配置 public function __set($key,$value) { $this->data[$key]=$value; } } $conf = conf::getIns(); ?> ``` ``` <?php // fiel:init.php 框架初始化 //初始化当前的路径 //echo substr(str_replace('\\','/',__FILE__),0,-8); define('ROOT',str_replace ('\\','/',dirname(dirname(__FILE__)).'/')); define('debug',true); require(ROOT.'include/db.class.php'); require(ROOT.'include/mysql.class.php'); require(ROOT.'include/conf.class.php'); require(ROOT.'include/log.class.php'); require(ROOT.'include/lib_base.php'); //过滤参数 $_GET =_addslashes($_GET); $_POST=_addslashes($_POST); $_COOKIE=_addslashes($_COOKIE); // 设置报错级别 if(defined('DEBUG')){ error_reporting(E_ALL);} else{ error_reporting(0);} ?> ```
mysql binlog里为啥会有rollback?
摘自master服务器的binlog信息: #160310 10:49:31 server id 136 end_log_pos 1620489 CRC32 0x649900b9 Query thread_id=1575568 exec_time=0 error_code=0 SET TIMESTAMP=1457578171/*!*/; SET @@session.sql_mode=1075838976/*!*/; ROLLBACK /*!*/; # at 1620489 为什么会出现rollback? 如果一个事务回滚的话,那么涉及该事务的所有语句应该都不会出现在binlog中才对啊。 求解!(复制模式为statement-based)
windows下MySQL5.7.19无法启动日志是为什么
安装的是解压缩版的MySQL5.7.19,可以正常启动和进入mysql,但是一直无法启动日志, ![图片说明](https://img-ask.csdn.net/upload/201709/20/1505890481_954674.png) 以下是我的my.ini内容,希望各路大神能够指导一下我: # 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. [client] default-character-set=utf8 [mysqld] port=3306 log-bin =mysql-bin default-storage-engine=INNODB character-set-server=utf8 collation-server=utf8_general_ci basedir ="E:\MySQL\mysql-5.7.19-winx64/" datadir ="E:\MySQL\mysql-5.7.19-winx64/data/" tmpdir ="E:\MySQL\mysql-5.7.19-winx64/data/" socket ="E:\MySQL\mysql-5.7.19-winx64/data/mysql.sock" log-error="E:\MySQL\mysql-5.7.19-winx64/data/mysql_error.log" server-id =1 #skip-locking max_connections=100 table_open_cache=256 query_cache_size=1M tmp_table_size=32M thread_cache_size=8 innodb_data_home_dir="E:\MySQL\mysql-5.7.19-winx64/data/" innodb_flush_log_at_trx_commit =1 innodb_log_buffer_size=128M innodb_buffer_pool_size=128M innodb_log_file_size=10M innodb_thread_concurrency=16 innodb-autoextend-increment=1000 join_buffer_size = 128M sort_buffer_size = 32M read_rnd_buffer_size = 32M max_allowed_packet = 32M explicit_defaults_for_timestamp=true sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" skip-grant-tables #sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
mysql数据库的group by问题
可执行sql: SELECT oc.cabinet_id objectId, CONCAT_WS( '/', di.driver_name, ri.plate_number ) driver, tcc.business_mode businessMode, so.`name` subName, cci.carteam_name affName, oo.order_No orderNo, oo.book_Space_No bookSpaceNo, oc.cabinet_No cabinetNo, oc.cabinet_Type conType, oo.order_type orderType, ss.dispatch_type dispatchType, st.remark remark, oo.address address, date_format( cc.settlement_date, '%Y-%m' ) endDate, date_format( cc.settlement_date, '%Y-%m-%d' ) settlementDate, cc.cost_status costStatus, sum( cc.pay_amount ) total FROM t_ord_cabinet_cost cc LEFT JOIN t_ord_cabinet oc ON oc.cabinet_id = cc.cabinet_id LEFT JOIN t_ord_order oo ON oo.order_id = oc.order_id LEFT JOIN t_sch_task st ON st.cabinet_id = oc.cabinet_id LEFT JOIN t_sch_schedule ss ON ss.id = st.schedule_id LEFT JOIN t_car_carteam_info cci ON cci.carteam_id = ss.carteam_id LEFT JOIN t_dri_driver_info di ON ss.driver_id = di.driver_info_id LEFT JOIN t_car_trailer_info ri ON ss.trailer_id = ri.trailer_id LEFT JOIN t_sys_org so ON so.org_code = oo.org_code LEFT JOIN t_cus_customer tcc ON tcc.customer_id = cc.settlement_customer_id LEFT JOIN sys_user_info us ON us.user_id = tcc.salesman_id WHERE cc.cost_status IN ( 0, 3 ) AND ( cc.settlement_date IS NOT NULL OR cc.settlement_date != '' ) AND cc.break_rule_state IN ( 0, 2 ) AND cc.cost_type_code IN ( '26', '2', '3', '8', '9', '10' ) AND ( cc.pay_amount != 0 AND cc.pay_amount IS NOT NULL ) AND so.LEVEL = 2 AND so.minimum_guarantee = 1 AND oo.order_status != 0 AND ss.schedule_status = 4 AND tcc.settle_accounts = 1 GROUP BY objectId, so.org_code, cci.carteam_id, endDate, di.driver_info_id, ri.plate_number, oo.order_id, ss.id, st.id, tcc.business_mode, cc.cost_status, date_format( cc.settlement_date, '%Y-%m-%d' ) ORDER BY driver, objectId, orderNo, bookSpaceNo, dispatchType, endDate DESC 不可执行sql: SELECT oc.cabinet_id objectId, CONCAT_WS( '/', sc.driver_name, sc.plate_number ) driver, sc.business_mode businessMode, oo.`company_name` subName, sc.carteam_name affName, oo.order_No orderNo, oo.book_Space_No bookSpaceNo, oc.cabinet_No cabinetNo, oc.cabinet_Type conType, oo.order_type orderType, sc.dispatch_type dispatchType, sc.task_remark remark, oo.address address, date_format( cc.settlement_date, '%Y-%m' ) endDate, date_format( cc.settlement_date, '%Y-%m-%d' ) settlementDate, cc.cost_status costStatus, sum( cc.pay_amount ) total FROM t_ord_cabinet_cost cc LEFT JOIN t_sett_cost sc ON cc.cabinet_cost_id = sc.cabinet_cost_id LEFT JOIN t_ord_cabinet oc ON oc.cabinet_id = cc.cabinet_id LEFT JOIN t_ord_order oo ON oo.order_id = oc.order_id LEFT JOIN t_sys_org so ON oo.org_code = so.org_code WHERE cc.cost_status IN ( 0, 3 ) AND ( cc.settlement_date IS NOT NULL OR cc.settlement_date != '' ) AND cc.break_rule_state IN ( 0, 2 ) AND sc.cost_type_class IN ( 0, 1 ) AND ( cc.pay_amount != 0 AND cc.pay_amount IS NOT NULL ) AND so.LEVEL = 2 AND so.minimum_guarantee = 1 AND oo.order_status != 0 AND sc.schedule_status = 4 AND sc.settle_accounts = 1 GROUP BY objectId, so.org_code, sc.carteam_id, endDate, sc.driver_info_id, sc.plate_number, oo.order_id, -- ss.id, -- st.id, sc.business_mode, cc.cost_status, date_format( cc.settlement_date, '%Y-%m-%d' ) ORDER BY driver, objectId, orderNo, bookSpaceNo, dispatchType, endDate DESC 问题:为什么第一个sql语句可以执行,第二个sql语句不可执行?
为什么mysql5.6没有my.ini配置文件
我是到官网下的5.6zip windows版本,只有一个my-default.ini 内容那个也很简单 # For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.6/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] # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # These are commonly set, remove the # and set as required. basedir = C:\Program Files\MySQL\MySQL Server 5.6 datadir = C:\Program Files\MySQL\MySQL Server 5.6\data # port = ..... # server_id = ..... # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
如何理解mysql高版本(8)的group by?
``` SELECT a.*,c.orgName AS dutyOrgNames,GROUP_CONCAT(e.userName) AS projectLeaderNames FROM majorProject a LEFT JOIN projectdutyorg b ON (a.id = b.projectId) LEFT JOIN organization c ON (c.id = b.orgId) LEFT JOIN projectleader d ON (d.projectId = a.id) LEFT JOIN userinfo e ON (e.id = d.userId) WHERE 1=1 AND a.isDelete = 0 GROUP BY a.id ``` 这是之前写的一段sql,会提示错误: ``` Expression #23 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'dcdb_guangan_190815.c.ORGNAME' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by ``` 如果在group by a.id后面加上",c.orgName"则查询成功,但是无法达到之前sql想要的结果。 我尝试解析新group by的用法,最开始同事告诉我使用group by时,必须和select字段一致,或者使用分组函数max之类的。但是我修改代码后: ``` SELECT a.*,GROUP_CONCAT(e.userName) AS projectLeaderNames FROM majorProject a LEFT JOIN projectdutyorg b ON (a.id = b.projectId) LEFT JOIN organization c ON (c.id = b.orgId) LEFT JOIN projectleader d ON (d.projectId = a.id) LEFT JOIN userinfo e ON (e.id = d.userId) WHERE 1=1 AND a.isDelete = 0 GROUP BY a.id ``` 这段sql运行成功了,但让我不解的是a.星号里面包含了很多字段,并没有和group by后面的字段一致。之后我认为,应该是a.id是主键的原因,将a.星号中的一个字段也加上主键标识,出现了错误: ``` Expression #23 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'dcdb_guangan_190815.a.RECORDRECORDCREATETIME' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by ``` a.RECORDCREATETIME是a.*中的一个字段。 我总结为:如果select字段中存在主键字段,那么必须与group by后面一致。但是问题在于,最开始出现的报错c.orgName,这个字段并不是主键字段。 非常迷惑,望各位大佬解答,在网上搜了一些资料,都只说如何解决,但是解决方案最佳也仅仅是改配置文件,对我来说这样的解决方法不太友好,我希望理解group by的用法,通过修改sql去解决这个问题。
并发1000左右,数据优化
Linux服务器:64G内存、320G硬盘、20M带宽;nginx、PHP、MySQL MySQL数据量在1亿左右。现在并发是10000,宝塔后台负载状态一直都是100%,业务处理/数据访问比较多【数据库增删改查频繁】。服务器运行一段时间之后MySQL崩溃了,重启MySQL之后,命令链接mysql -uroot -p 输入密码后需要很久才能连接到数据库,有时还会卡死导致无法连接数据库。 nginx配置图 ``` user www www; worker_processes auto; error_log /www/wwwlogs/nginx_error.log crit; pid /www/server/nginx/logs/nginx.pid; worker_rlimit_nofile 51200; events { use epoll; worker_connections 51200; multi_accept on; } http { include mime.types; #include luawaf.conf; include proxy.conf; default_type application/octet-stream; server_names_hash_bucket_size 512; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 50m; sendfile on; tcp_nopush on; keepalive_timeout 60; tcp_nodelay on; fastcgi_connect_timeout 100; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_buffer_size 64k; fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 256k; fastcgi_intercept_errors on; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.1; gzip_comp_level 2; gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml; gzip_vary on; gzip_proxied expired no-cache no-store private auth; gzip_disable "MSIE [1-6]\."; limit_conn_zone $binary_remote_addr zone=perip:10m; limit_conn_zone $server_name zone=perserver:10m; server_tokens off; access_log off; ``` MySQL配置文件 ``` #password = your_password port = 3306 socket = /mysql_log/mysql.sock [mysqld] binlog_cache_size = 256K thread_stack = 512K join_buffer_size = 8192K query_cache_type = 0 max_heap_table_size = 2048M port = 3306 socket = /mysql_log/mysql.sock datadir = /www/server/data default_storage_engine = InnoDB performance_schema_max_table_instances = 400 table_definition_cache = 400 skip-external-locking key_buffer_size = 1024M max_allowed_packet = 100G table_open_cache = 2048 sort_buffer_size = 4096K net_buffer_length = 4K read_buffer_size = 4096K read_rnd_buffer_size = 2048K myisam_sort_buffer_size = 256M thread_cache_size = 256 query_cache_size = 0M tmp_table_size = 2048M sql-mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES explicit_defaults_for_timestamp = true #skip-name-resolve max_connections = 500 max_connect_errors = 100 open_files_limit = 65535 wait_timeout=100 interactive_timeout=100 #log-bin=mysql-bin #binlog_format=mixed server-id = 1 expire_logs_days = 1 slow_query_log=1 slow-query-log-file=/www/server/data/mysql-slow.log long_query_time=3 #log_queries_not_using_indexes=on early-plugin-load = "" innodb_data_home_dir = /www/server/data innodb_data_file_path = ibdata1:10M:autoextend innodb_log_group_home_dir = /www/server/data innodb_buffer_pool_size = 4096M innodb_log_file_size = 2048M innodb_log_buffer_size = 0M innodb_flush_log_at_trx_commit = 1 innodb_lock_wait_timeout = 50 innodb_max_dirty_pages_pct = 90 innodb_read_io_threads = 32 innodb_write_io_threads = 32 [mysqldump] quick max_allowed_packet = 500M [mysql] no-auto-rehash [myisamchk] key_buffer_size = 1024M sort_buffer_size = 16M read_buffer = 2M write_buffer = 2M [mysqlhotcopy] #interactive-timeout ```
查询 数据库中小学生对应的用户权限 已知 小学生 密码111111
/* SQLyog Ultimate v11.27 (32 bit) MySQL - 5.6.24 : Database - mydb ********************************************************************* */ /*!40101 SET NAMES utf8 */; /*!40101 SET SQL_MODE=''*/; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; CREATE DATABASE /*!32312 IF NOT EXISTS*/`mydb` /*!40100 DEFAULT CHARACTER SET utf8 */; USE `mydb`; /*Table structure for table `menuinfo` */ DROP TABLE IF EXISTS `menuinfo`; CREATE TABLE `menuinfo` ( `id` int(11) NOT NULL AUTO_INCREMENT, `MenuName` varchar(20) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; /*Data for the table `menuinfo` */ insert into `menuinfo`(`id`,`MenuName`) values (1,'文件'),(2,'编辑'),(3,'查看'),(4,'格式'),(5,'帮助'); /*Table structure for table `roleinfo` */ DROP TABLE IF EXISTS `roleinfo`; CREATE TABLE `roleinfo` ( `id` int(11) NOT NULL AUTO_INCREMENT, `RoleName` varchar(20) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; /*Data for the table `roleinfo` */ insert into `roleinfo`(`id`,`RoleName`) values (1,'管理员'),(2,'客户'),(3,'VIP'),(4,'游客'); /*Table structure for table `rolemenu` */ DROP TABLE IF EXISTS `rolemenu`; CREATE TABLE `rolemenu` ( `id` int(11) NOT NULL AUTO_INCREMENT, `RoleId` int(11) DEFAULT NULL, `MenuId` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `FK_rolemenu_1` (`RoleId`), KEY `FK_rolemenu_2` (`MenuId`), CONSTRAINT `FK_rolemenu_1` FOREIGN KEY (`RoleId`) REFERENCES `roleinfo` (`id`), CONSTRAINT `FK_rolemenu_2` FOREIGN KEY (`MenuId`) REFERENCES `menuinfo` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8; /*Data for the table `rolemenu` */ insert into `rolemenu`(`id`,`RoleId`,`MenuId`) values (1,1,1),(2,1,2),(3,1,3),(4,1,4),(5,1,5),(6,2,1),(7,2,3),(8,2,5),(9,3,1),(10,3,3),(11,3,4),(12,3,5),(13,4,3),(14,4,5); /*Table structure for table `userinfo` */ DROP TABLE IF EXISTS `userinfo`; CREATE TABLE `userinfo` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(20) DEFAULT NULL, `userpassword` varchar(50) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; /*Data for the table `userinfo` */ insert into `userinfo`(`id`,`username`,`userpassword`) values (1,'网管','123456'),(2,'小学生','111111'),(3,'黄钻','222222'),(4,'路人甲',NULL),(5,'网小管','154321'),(6,'初中生','111111'),(7,'高中生','111111'); /*Table structure for table `userrole` */ DROP TABLE IF EXISTS `userrole`; CREATE TABLE `userrole` ( `id` int(11) NOT NULL AUTO_INCREMENT, `UserId` int(11) DEFAULT NULL, `RoleId` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `FK_userrole` (`UserId`), KEY `FK_userrole_1` (`RoleId`), CONSTRAINT `FK_userrole` FOREIGN KEY (`UserId`) REFERENCES `userinfo` (`id`), CONSTRAINT `FK_userrole_1` FOREIGN KEY (`RoleId`) REFERENCES `roleinfo` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; /*Data for the table `userrole` */ insert into `userrole`(`id`,`UserId`,`RoleId`) values (1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,1),(6,6,2),(7,7,2); /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
Forced node shutdown completed. Occured during startphase 0. Initiated by signal 9.
mysql集群 # ①版本:mysql-cluster-gpl-7.5.9-linux-glibc2.12-x86_64 # ②概述: 三台服务器: xxx.xx.xxx.1: 管理节点, sql节点 xxx.xx.xxx.2: 数据节点(1) sql节点 xxx.xx.xxx.3: 数据节点 (2) sql节点 # ③配置文件: ## config.ini [ndbd default] NoOfReplicas=2 DataMemory=80M IndexMemory=18M [mysqld default] [ndb_mgmd default] [tcp default] # Cluster Control / Management node [ndb_mgmd] hostname=xxx.xx.xx.1 datadir=/var/lib/mysql-cluster/cluster-data NodeId=1 MaxNoOfAttributes=5000000 MaxNoOfConcurrentTransactions=1000000 MaxNoOfConcurrentOperations=1000000 # Data Node 1 [ndbd] hostname=xxx.xx.xxx.2 datadir=/usr/local/mysql/data NodeId=2 MaxNoOfAttributes=5000000 MaxNoOfConcurrentTransactions=1000000 MaxNoOfConcurrentOperations=1000000 # Data Node 2 [ndbd] hostname=xxx.xx.xxx.3 datadir=/usr/local/mysql/data NodeId=3 MaxNoOfAttributes=5000000 MaxNoOfConcurrentTransactions=1000000 MaxNoOfConcurrentOperations=1000000 # SQL Node [mysqld] hostname=xxx.xx.xxx.1 NodeId=4 [mysqld] hostname=xxx.xx.xxx.2 NodeId=5 [mysqld] hostname=xxx.xx.xxx.3 NodeId=6 # If you to add new SQL Node [mysqld] [mysqld] [mysqld] ## my.cnf(xxx.xx.xxx.2) jinsan@shopping2:~$ cat /etc/my.cnf [mysqld] ndbcluster # run NDB storage engine datadir=/data/mysql basedir=/opt/mysql-cluster-gpl-7.5.9-linux-glibc2.12-x86_64 ndb-connectstring=172.17.154.237 user=mysql sql_mode=NO_ENGINE_SUBSTITUTION #,STRICT_TRANS_TABLES max_connections=500 interactive_timeout=28800 wait_timeout=28800 explicit_defaults_for_timestamp=true [mysql_cluster] ndb-connectstring=172.17.154.237 ## my.cnf(xxx.xx.xxx.3) root@shopping3:/home/jinsan# cat /etc/my.cnf [mysqld] ndbcluster # run NDB storage engine datadir=/data/mysql basedir=/opt/mysql-cluster-gpl-7.5.9-linux-glibc2.12-x86_64 ndb-connectstring=xxx.xx.xxx.1 sql_mode=NO_ENGINE_SUBSTITUTION #,STRICT_TRANS_TABLES max_connections=500 interactive_timeout=28800 wait_timeout=28800 explicit_defaults_for_timestamp=true [mysql_cluster] ndb-connectstring=xxx.xx.xxx.1 # ④问题: 管理节点,sql节点均正常, 数据节点1正常, 数据节点2启动时: ndb_mgm> Node 3: Forced node shutdown completed. Occured during startphase 0. Initiated by signal 9. 请问大神原因是什么 ? 该怎么处理? 不是新搭建的集群,是运行一段时间后
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 free -m 其中:m表示兆,也可以用g,注意都要小写 Men:表示物理内存统计 total:表示物理内存总数(total=used+free) use...
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入 假设现有4个人...
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发...
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 演示地点演示 html代码如下` music 这个年纪 七月的风 音乐 ` 然后就是css`*{ margin: 0; padding: 0; text-decoration: none; list-...
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。
数据库优化 - SQL优化
以实际SQL入手,带你一步一步走上SQL优化之路!
通俗易懂地给女朋友讲:线程池的内部原理
餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
使用 Docker 部署 Spring Boot 项目
Docker 技术发展为微服务落地提供了更加便利的环境,使用 Docker 部署 Spring Boot 其实非常简单,这篇文章我们就来简单学习下。首先构建一个简单的 S...
英特尔不为人知的 B 面
从 PC 时代至今,众人只知在 CPU、GPU、XPU、制程、工艺等战场中,英特尔在与同行硬件芯片制造商们的竞争中杀出重围,且在不断的成长进化中,成为全球知名的半导体公司。殊不知,在「刚硬」的背后,英特尔「柔性」的软件早已经做到了全方位的支持与支撑,并持续发挥独特的生态价值,推动产业合作共赢。 而对于这一不知人知的 B 面,很多人将其称之为英特尔隐形的翅膀,虽低调,但是影响力却不容小觑。 那么,在...
面试官:你连RESTful都不知道我怎么敢要你?
干货,2019 RESTful最贱实践
刷了几千道算法题,这些我私藏的刷题网站都在这里了!
遥想当年,机缘巧合入了 ACM 的坑,周边巨擘林立,从此过上了"天天被虐似死狗"的生活… 然而我是谁,我可是死狗中的战斗鸡,智力不够那刷题来凑,开始了夜以继日哼哧哼哧刷题的日子,从此"读题与提交齐飞, AC 与 WA 一色 ",我惊喜的发现被题虐既刺激又有快感,那一刻我泪流满面。这么好的事儿作为一个正直的人绝不能自己独享,经过激烈的颅内斗争,我决定把我私藏的十几个 T 的,阿不,十几个刷题网...
白话阿里巴巴Java开发手册高级篇
不久前,阿里巴巴发布了《阿里巴巴Java开发手册》,总结了阿里巴巴内部实际项目开发过程中开发人员应该遵守的研发流程规范,这些流程规范在一定程度上能够保证最终的项目交付质量,通过在时间中总结模式,并推广给广大开发人员,来避免研发人员在实践中容易犯的错误,确保最终在大规模协作的项目中达成既定目标。 无独有偶,笔者去年在公司里负责升级和制定研发流程、设计模板、设计标准、代码标准等规范,并在实际工作中进行...
SQL-小白最佳入门sql查询一
不要偷偷的查询我的个人资料,即使你再喜欢我,也不要这样,真的不好;
redis分布式锁,面试官请随便问,我都会
文章有点长并且绕,先来个图片缓冲下! 前言 现在的业务场景越来越复杂,使用的架构也就越来越复杂,分布式、高并发已经是业务要求的常态。像腾讯系的不少服务,还有CDN优化、异地多备份等处理。 说到分布式,就必然涉及到分布式锁的概念,如何保证不同机器不同线程的分布式锁同步呢? 实现要点 互斥性,同一时刻,智能有一个客户端持有锁。 防止死锁发生,如果持有锁的客户端崩溃没有主动释放锁,也要保证锁可以正常释...
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
Nginx 原理和架构
Nginx 是一个免费的,开源的,高性能的 HTTP 服务器和反向代理,以及 IMAP / POP3 代理服务器。Nginx 以其高性能,稳定性,丰富的功能,简单的配置和低资源消耗而闻名。 Nginx 的整体架构 Nginx 里有一个 master 进程和多个 worker 进程。master 进程并不处理网络请求,主要负责调度工作进程:加载配置、启动工作进程及非停升级。worker 进程负责处...
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU...
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
Java世界最常用的工具类库
Apache Commons Apache Commons有很多子项目 Google Guava 参考博客
程序员把地府后台管理系统做出来了,还有3.0版本!12月7号最新消息:已在开发中有github地址
第一幕:缘起 听说阎王爷要做个生死簿后台管理系统,我们派去了一个程序员…… 996程序员做的梦: 第一场:团队招募 为了应对地府管理危机,阎王打算找“人”开发一套地府后台管理系统,于是就在地府总经办群中发了项目需求。 话说还是中国电信的信号好,地府都是满格,哈哈!!! 经常会有外行朋友问:看某网站做的不错,功能也简单,你帮忙做一下? 而这次,面对这样的需求,这个程序员...
网易云6亿用户音乐推荐算法
网易云音乐是音乐爱好者的集聚地,云音乐推荐系统致力于通过 AI 算法的落地,实现用户千人千面的个性化推荐,为用户带来不一样的听歌体验。 本次分享重点介绍 AI 算法在音乐推荐中的应用实践,以及在算法落地过程中遇到的挑战和解决方案。 将从如下两个部分展开: AI算法在音乐推荐中的应用 音乐场景下的 AI 思考 从 2013 年 4 月正式上线至今,网易云音乐平台持续提供着:乐屏社区、UGC...
【技巧总结】位运算装逼指南
位算法的效率有多快我就不说,不信你可以去用 10 亿个数据模拟一下,今天给大家讲一讲位运算的一些经典例子。不过,最重要的不是看懂了这些例子就好,而是要在以后多去运用位运算这些技巧,当然,采用位运算,也是可以装逼的,不信,你往下看。我会从最简单的讲起,一道比一道难度递增,不过居然是讲技巧,那么也不会太难,相信你分分钟看懂。 判断奇偶数 判断一个数是基于还是偶数,相信很多人都做过,一般的做法的代码如下...
为什么要学数据结构?
一、前言 在可视化化程序设计的今天,借助于集成开发环境可以很快地生成程序,程序设计不再是计算机专业人员的专利。很多人认为,只要掌握几种开发工具就可以成为编程高手,其实,这是一种误解。要想成为一个专业的开发人员,至少需要以下三个条件: 1) 能够熟练地选择和设计各种数据结构和算法 2) 至少要能够熟练地掌握一门程序设计语言 3) 熟知所涉及的相关应用领域的知识 其中,后两个条件比较容易实现,而第一个...
Android 9.0 init 启动流程
阅读五分钟,每日十点,和您一起终身学习,这里是程序员Android本篇文章主要介绍Android开发中的部分知识点,通过阅读本篇文章,您将收获以下内容:一、启动流程概述一、 启动流程概述Android启动流程跟Linux启动类似,大致分为如下五个阶段。1.开机上电,加载固化的ROM。2.加载BootLoader,拉起Android OS。3.加载Uboot,初始外设,引导Kernel启动等。...
相关热词 c# clr dll c# 如何orm c# 固定大小的字符数组 c#框架设计 c# 删除数据库 c# 中文文字 图片转 c# 成员属性 接口 c#如何将程序封装 16进制负数转换 c# c#练手项目
立即提问