Mysql的东西,摘抄或者总结
引用
/usr/local/coreseek/bin/indexer: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory


可以先找到文件在哪里

locate libmysqlclient.so.18
/alidata/server/mysql-5.6.21/lib/libmysqlclient.so.18
/alidata/server/mysql-5.6.21/lib/libmysqlclient.so.18.1.0


我们可以把路径加入ld.so.conf
vi /etc/ld.so.conf
加入一行
/alidata/server/mysql-5.6.21/lib

保存后执行 ldconfig -v 可以更新
然后执行命令就没问题了
utf8的数据库,存入表情符,会出错

Incorrect string value: '\xF0\x9F\x98\x84\xF0\x9F...' for column 'content'


错误的解决办法:

引用
4 byte Unicode characters aren't yet widely used, so not every application out there fully supports them. MySQL 5.5 works fine with 4 byte characters when properly configured – check if your other components can work with them as well.

Here's a few other things to check out:

Make sure all your tables' default character sets and text fields are converted to utf8mb4, in addition to setting the client & server character sets, e.g. ALTER TABLE mytable charset=utf8mb4, MODIFY COLUMN textfield1 VARCHAR(255) CHARACTER SET utf8mb4,MODIFY COLUMN textfield2 VARCHAR(255) CHARACTER SET utf8mb4; and so on.

If your data is already in the utf8 character set, it should convert to utf8mb4 in place without any problems. As always, back up your data before trying!

Also make sure your app layer sets its database connections' character set to utf8mb4. Double-check this is actually happening – if you're running an older version of your chosen framework's mysql client library, it may not have been compiled with utf8mb4 support and it won't set the charset properly. If not, you may have to update it or compile it yourself.

When viewing your data through the mysql client, make sure you're on a machine that can display emoji, and run a SET NAMES utf8mb4 before running any queries.

Once every level of your application can support the new characters, you should be able to use them without any corruption.


总结就是,表结构改为支持4字节的unicode,数据库连接也用这个字符集哦,证明是可行的。
如果别的地方不支持,可以考虑去掉这些字符:

引用
Since 4-byte UTF-8 sequences always start with the bytes 0xF0-0xF7, the following should work:

$str = preg_replace('/[\xF0-\xF7].../s', '', $str);
Alternatively, you could use preg_replace in UTF-8 mode but this will probably be slower:

$str = preg_replace('/[\x{10000}-\x{10FFFF}]/u', '', $str);
This works because 4-byte UTF-8 sequences are used for code points in the supplementary Unicode planes starting from 0x10000.


参考来源:
http://stackoverflow.com/q...
http://stackoverflow.com/q...
今天碰到同步出错提示:

引用
140614 14:33:02 [Note] Slave I/O thread killed while reading event
140614 14:33:02 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.000343', position 262037824
140614 14:33:02 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000343' at position 210829116, relay log '/xy/3306/logs/relay-bin.000328' position: 210607951
140614 14:33:02 [Note] Slave I/O thread: connected to master 'slave@x.x.x.x:3306',replication started in log 'mysql-bin.000343' at position 262037824
140614 14:33:02 [ERROR] Error in Log_event::read_log_event(): 'read error', data_len: 1018, event_type: 2
140614 14:33:02 [ERROR] Error reading relay log event: slave SQL thread aborted because of I/O error
140614 14:33:02 [ERROR] Slave SQL: Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave. Error_code: 1594
140614 14:33:02 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'mysql-bin.000343' position 210829116


注意两个地方:
1 Slave I/O thread exiting, read up to log 'mysql-bin.000343', position 262037824
2 We stopped at log 'mysql-bin.000343' position 210829116

看上面的提示是:I/O是从master读取日志的,SQL进程是执行sql的,下载日志已经到了262037824,执行日志到了210829116
解决方式可以是重新指定同步的位置

slave stop;
change master to
master_log_file='mysql-bin.000343',
master_log_pos=210829116;
slave start;


这样的操作是可以恢复正常了

紧接着,发现另外一个数据库也通知了,是I/O进程出错:
(master意外断电重启会容易发生此问题)

引用
140614 15:02:25 [ERROR] Error reading packet from server: Client requested master to start replication from impossible position ( server_errno=1236)
140614 15:02:25 [ERROR] Slave I/O: Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position', Error_code: 1236
140614 15:02:25 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.000097', position 570181940


查看master的97号日志:

引用
mysqlbinlog mysql-bin.000097|tail
ERROR: Error in Log_event::read_log_event(): 'read error', data_len: 2693, event_type: 2
/*!*/;
# at 569944220
#140614 13:50:28 server id 201  end_log_pos 569944431   Query  thread_id=438664782  exec_time=4294967273  error_code=0
SET TIMESTAMP=1402725028/*!*/;
UPDATE  xyz...
/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;


看日志最后的位置是 569944220,也就是需要从新的日志开始同步了
可以尝试这样重新同步:

change master to
master_log_file='mysql-bin.000098',
master_log_pos=0;

不过应该是从107开始的?0好像也没错,就是它了
发现数据库同步失败,但没有sql错误,查看错误日志,得到类似错误

[ERROR] Error reading packet from server: Client requested master to start replication from impossible position ( server_errno=1236)


主服务器发生过一次断电,这个是会导致这个问题。
这个错误必须人工干涉,因为发生这样的错误,不确定是否会产生数据问题,或者发生了别的不可预知的问题。

简单恢复这个问题是重新指定开始的位置,因为上一个日志文件应该是同步完了,没有正常关闭日志,所以不确定是否应该开始从下一个日志开始,我们可以告诉slave从下一个日志开始,记得前后应该停止和开始同步:

CHANGE MASTER TO MASTER_LOG_FILE='下一个日志', MASTER_LOG_POS=4;


参考阅读:
http://www.skysql.com/blogs/adam-donnison/client-requested-master-start-replication-impossible-position
(转)在做MySQL主从复制时遇到个ERROR 1201 (HY000): Could not initialize master info structure .
出现这个问题的原因是之前曾做过主从复制!
  
解决方案是:

运行命令 stop slave;
成功执行后继续运行 reset slave;
然后重新设置主从复制。

具体过程如下:
mysql> change master to master_host='127.0.0.1', master_user='user', master_pass  
word='user', master_log_file='mysql-bin-000202', master_log_pos=553;  
ERROR 1201 (HY000): Could not initialize master info structure; more error messa  
ges can be found in the MySQL error log  
mysql> stop slave;  
Query OK, 0 rows affected, 1 warning (0.00 sec)  
  
mysql> reset slave;  
Query OK, 0 rows affected (0.00 sec)  
  
mysql> change master to master_host='127.0.0.1', master_user='user', master_pass  
word='user', master_log_file='mysql-bin-000202', master_log_pos=553;  
Query OK, 0 rows affected (0.11 sec)  
分页: 1/8 第一页 1 2 3 4 5 6 7 8 下页 最后页 [ 显示模式: 摘要 | 列表 ]

阅读推荐

服务器相关推荐

开发相关推荐

应用软件推荐