MYSQL (15)

How to import mysql innodb with foreign key constraint error?

To import mysql innodb with foreign key constraint error, follow the steps below:- If you have the access to mysql thru terminal, then you can use the command below:- mysql> SET foreign_key_checks = 0; mysql> SOURCE your_db_dump_file; mysql> SET foreign_key_checks = 1; If you import your database thru web interface like phpmyadmin, then you need to edit the sql dump file. Add this to the 1st line of your sql db dump file:- SET foreign_key_checks = 0; then add this line to the last line in your sql db dump file:- SET foreign_key_checks = 1; Now you may import your…
Read more...

[ERROR] /usr/libexec/mysqld: Can't open file: '.s.frm' (errno: 24)

130522 1:45:20 [ERROR] /usr/libexec/mysqld: Can't open file: './alamise/alamise_categories.frm' (errno: 24) ----------------------------------------------------------------- ps -ef|grep mysql 查看 pid pid 32150 --------------------------------------------------------------------- cat /proc/32150/limits |grep files 查看pid最大limite ------------------------------------------------- lsof -p 32150 |wc -l 查看已经打开的数量 lsof | grep mysqld 查看列表 ----------------------------------------------------------- 查看 mysql值 mysql -uUser -pPASS show global variables like "%open_files_limit%"; ------------------------------------- 修复表 mysqlcheck -A -o -r -p password ---------------------------------------- 更改 /etc/my.cnf [mysqld] open_files_limit = 100000
Read more...

mysqldump: Couldn’t execute ‘SHOW FUNCTION STATUS WHERE Db = ‘your-db-here”: Column count of mysql.proc is wrong. Expected 20, found 16. Created with MySQL 50077, now running 50152. Please use mysql_upgrade to fix this error. (1558)

mysqldump: Couldn’t execute ‘SHOW FUNCTION STATUS WHERE Db = ‘your-db-here”: Column count of mysql.proc is wrong. Expected 20, found 16. Created with MySQL 50077, now running 50152. Please use mysql_upgrade to fix this error. (1558) /usr/bin/mysql_upgrade -uxxxx -pxxxxxx 如果你的webmin/virtualmin自动备份出现下面的错误,那么,就是mysql升级后没有做mysql_upgrade 表修复。 在新版下执行mysql_upgrade命令,其实这个命令包含一下三个命令: # mysqlcheck –check-upgrade –all-databases –auto-repai # mysql_fix_privilege_tables # mysqlcheck –all-databases –check-upgrade –fix-db-names –fix-table-names Note: 在每一次的升级过程中,mysql_upgrade这个命令我们都应该去执行,它通过mysqlcheck命令帮我们去检查表是否兼容新版本的数据库同时作出修复,还有个很重要的作用就是使用mysql_fix_privilege_tables命令去升级权限表。
Read more...

重启MySQL的正确方法

如果你是从源码包安装的Mysql,那么系统中是没有红帽常用的servcie这个脚本的, 所以只好手工重启 有人建议Killall mysql。这种野蛮的方法其实是不行的,强制终止的话,可能会造成表损坏,损失是巨大的。 这里推荐安全的重启方法 $mysql_dir/bin/mysqladmin -u root -p shutdown $mysql_dir/bin/safe_mysqld & mysqladmin和mysqld_safe位于Mysql安装目录的bin目录下,很容易找到的。 /usr/bin/mysqladmin -u root -p shutdown
Read more...

[ERROR] /usr/libexec/mysqld: Can't open file: './xxx/xxxxxxxxx.frm' (errno: 24)

my.cnf innodb_open_files=1024 open_files_limit=5000 mysql -uroot -pXXXXX 1,显示当前系统的文件限制# cat /proc/sys/fs/file-max调整参考:http://hi.baidu.com/loveyoursmile/blog/item/e26b550fed89ff226059f3c4.html2,通过phpmyadmin查询mysql配置参数(既open files limit)。一般情况下,mysql 5的open files limit会自动根据table cache调整。open files limit 系统默认调整为table cache的2倍多一点。 I go the following errors in a database: 091030 0:23:46 [ERROR] /usr/sbin/mysqld-max: Can't open file: './register/member.frm' (errno: 24)091030 0:23:46 [ERROR] /usr/sbin/mysqld-max: Can't open file: './register/description.frm' (errno: 24) This is related to file descriptors. # perror 24OS error code 24: Too many open files I enlarge the value of open_files_limit by adding a line in my.cnf. open_files_limit=5000 For open_files_limit, please refer this link: http://cherry.world.edoors.com/CozM0IXYA-fc For more explanation about this error, please refer this page: B.5.2.18. 'File' Not Found and Similar Errorshttp://dev.mysql.com/doc/refman/5.0/en/not-enough-file-handles.html how…
Read more...

2维数组 input 处理

输出 $rs9 = mysql_fetch_array($sql9);          if($rs9!=null)          {          $i=1;            do{        ?>         <tr>    <td id="mytd"></td>    <td id="mytd"><?php echo $ini_array['menu9_examen_Resultats_Examens'].":" ;?><input type="text" name="area[][1]"><input type="hidden" name="area[][2]" value=""></td>    </tr>        <?php $i++; }    while($rs9 = mysql_fetch_array($sql9));     } ?>   处理   if($_GET['action']=="submit"){$notes = $_POST['area'];}foreach(   $notes   as   $key=>   $value){        $resualt=mysql_query("                              REPLACE INTO `ilci`.`tbl_choix_examen_notes` (                              `notes_stu_id` ,                              `notes_empl_id` ,                              `notes_note`                              )                              VALUES (                              '$value[2]', '$empl_id', '$value[1]'                              );");          if($resualt){                    echo "<tr><td id=\"mytd\">".$ini_array['menu9_examen_mysql_success']."</td></tr>" ; }           else{                   echo "<tr><td id=\"mytd\">".$ini_array['menu9_examen_mysql_fail']."</td></tr>" ; }                         }            ?>            </table><?php} else {
Read more...

mysql TO_DAYS(date) 函数

TO_DAYS(date) 给定一个日期date, 返回一个天数 (从年份0开始的天数 )。 mysql> SELECT TO_DAYS(950501); -> 728779 mysql> SELECT TO_DAYS(‘1997-10-07′); -> 729669 TO_DAYS() 不用于阳历出现(1582)前的值,原因是当日历改变时,遗失的日期不会被考虑在内。 请记住, MySQL“日期和时间类型”中的规则将日期中的二位数年份值转化为四位。例如,  ‘1997-10-07′和 ‘97-10-07′ 被视为同样的日期: mysql> SELECT TO_DAYS(‘1997-10-07′), TO_DAYS(‘97-10-07′); -> 729669, 729669 对于1582 年之前的日期(或许在其它地区为下一年 ), 该函数的结果实不可靠的。
Read more...

( ! ) Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/category.php on line 191
Call Stack
#TimeMemoryFunctionLocation
10.0003398104{main}( ).../index.php:0
20.03001348448Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.03001348448Joomla\CMS\Application\SiteApplication->doExecute( ).../CMSApplication.php:196
40.11822875496Joomla\CMS\Application\SiteApplication->dispatch( $component = ??? ).../SiteApplication.php:233
50.11862899896Joomla\CMS\Component\ComponentHelper::renderComponent( $option = 'com_k2', $params = ??? ).../SiteApplication.php:194
60.11902955248Joomla\CMS\Component\ComponentHelper::executeComponent( $path = '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ).../ComponentHelper.php:377
70.11912972304require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php ).../ComponentHelper.php:402
80.12253104544K2ControllerItemlist->execute( $task = 'category' ).../k2.php:64
90.12253104544K2ControllerItemlist->display( $cachable = ???, $urlparams = ??? ).../BaseController.php:710
100.12483128168K2ControllerItemlist->display( $cachable = TRUE, $urlparams = ['limit' => 'UINT', 'limitstart' => 'UINT', 'id' => 'INT', 'tag' => 'STRING', 'searchword' => 'STRING', 'day' => 'INT', 'year' => 'INT', 'month' => 'INT', 'print' => 'INT', 'lang' => 'CMD', 'Itemid' => 'INT', 'ordering' => 'CMD', 'm' => 'INT', 'amp' => 'INT', 'tmpl' => 'CMD', 'template' => 'CMD'] ).../itemlist.php:49
110.12483128168K2ControllerItemlist->display( $cachable = TRUE, $urlparams = ['limit' => 'UINT', 'limitstart' => 'UINT', 'id' => 'INT', 'tag' => 'STRING', 'searchword' => 'STRING', 'day' => 'INT', 'year' => 'INT', 'month' => 'INT', 'print' => 'INT', 'lang' => 'CMD', 'Itemid' => 'INT', 'ordering' => 'CMD', 'm' => 'INT', 'amp' => 'INT', 'tmpl' => 'CMD', 'template' => 'CMD'] ).../controller.php:19
120.12543135680Joomla\CMS\Cache\Controller\ViewController->get( $view = class K2ViewItemlist { public $document = class Joomla\CMS\Document\HtmlDocument { public $_links = [...]; public $_custom = [...]; public $template = NULL; public $baseurl = NULL; public $params = NULL; public $_file = NULL; protected $_template = ''; protected $_template_tags = [...]; protected $_caching = NULL; private $_html5 = NULL; public $title = 'MYSQL'; public $description = ''; public $link = ''; public $base = 'https://www.shan.info/itemlist/category/63-mysql.html'; public $language = 'en-gb'; public $direction = 'ltr'; public $_generator = 'Joomla! - Open Source Content Management'; public $_mdate = ''; public $_tab = '\t'; public $_lineEnd = '\n'; public $_charset = 'utf-8'; public $_mime = 'text/html'; public $_namespace = ''; public $_profile = ''; public $_scripts = [...]; public $_script = [...]; protected $scriptOptions = [...]; public $_styleSheets = [...]; public $_style = [...]; public $_metaTags = [...]; public $_engine = NULL; public $_type = 'html'; protected $mediaVersion = '15dbf078d61dbbf76811992dd0143dd9' }; protected $_name = 'itemlist'; protected $_models = ['item' => class K2ModelItem { ... }, 'itemlist' => class K2ModelItemlist { ... }]; protected $_basePath = '/var/www/vhosts/shan.info/httpdocs/components/com_k2'; protected $_defaultModel = 'itemlist'; protected $_layout = 'category'; protected $_layoutExt = 'php'; protected $_layoutTemplate = '_'; protected $_path = ['template' => [...], 'helper' => [...]]; protected $_template = '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/category_item.php'; protected $_output = '\n<article class="itemView groupPrimary"> \t\n\t\t<time datetime="2012-01-04T11:21:39+01:00">\n\t\t04 Jan\t</time>\n\t\t\t\n\t<section>\t\t\n\t\t<header>\n\t\t\t\t\n\t\t\t\t\t\t<h2>\n\t\t\t\t\t\t\t\t\t\t<a href="/item/242-mysql-to_days-date-函数.html">mysql TO_DAYS(date) 函数</a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t\n\t\t\t<ul>\n\t\t\t\t\t\t\t\t<li class="itemCategory"> <span>Published in</span> <a href="/itemlist/category/63-mysql.html">MYSQL</a> </li>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<li cl'; protected $_escape = 'htmlspecialchars'; protected $_charset = 'UTF-8'; protected $_errors = []; public $baseurl = ''; public $now = '2021-09-21 03:47:49'; public $nullDate = '0000-00-00 00:00:00'; public $category = class TableK2Category { public $id = '63'; public $name = 'MYSQL'; public $alias = 'mysql'; public $description = ''; public $parent = '0'; public $extraFieldsGroup = '0'; public $published = '1'; public $image = '/components/com_k2/images/placeholder/category.png'; public $access = '1'; public $ordering = '15'; public $params = '{"inheritFrom":"0","theme":"","num_leading_items":"0","num_leading_columns":"1","leadingImgSize":"Large","num_primary_items":"10","num_primary_columns":"1","primaryImgSize":"Medium","num_secondary_items":"0","num_secondary_columns":"1","secondaryImgSize":"Small","num_links":"0","num_links_columns":"1","linksImgSize":"XSmall","catCatalogMode":"0","catFeaturedItems":"1","catOrdering":"","catPagination":"2","catPaginationResults":"1","catTitle":"1","catTitleItemCounter":"1","catDescription":"0","catImage":"0",'; public $trash = '0'; public $plugins = ''; public $language = '*'; protected $_tbl = '#__k2_categories'; protected $_tbl_key = 'id'; protected $_tbl_keys = [...]; protected $_db = class JDatabaseDriverMysqli { ... }; protected $_trackAssets = FALSE; protected $_rules = NULL; protected $_locked = FALSE; protected $_autoincrement = TRUE; protected $_observers = class JObserverUpdater { ... }; protected $_columnAlias = [...]; protected $_jsonEncode = [...]; protected $_errors = [...]; public $metaDescription = NULL; public $metaKeywords = NULL; public $metaRobots = NULL; public $metaAuthor = NULL; public $link = '/itemlist/category/63-mysql.html'; public $text = ''; public $jcfields = [...]; public $event = class stdClass { ... } }; public $user = class Joomla\CMS\User\User { protected $isRoot = FALSE; public $id = 0; public $name = NULL; public $username = NULL; public $email = NULL; public $password = NULL; public $password_clear = ''; public $block = NULL; public $sendEmail = 0; public $registerDate = NULL; public $lastvisitDate = NULL; public $activation = NULL; public $params = NULL; public $groups = [...]; public $guest = 1; public $lastResetTime = NULL; public $resetCount = NULL; public $requireReset = NULL; protected $_params = class Joomla\Registry\Registry { ... }; protected $_authGroups = NULL; protected $_authLevels = [...]; protected $_authActions = NULL; protected $_errorMsg = NULL; protected $userHelper = class Joomla\CMS\User\UserWrapper { ... }; protected $_errors = [...]; public $aid = 0; public $gid = 1 }; public $feed = 'https://www.shan.info/itemlist/category/63-mysql.html&format=feed&Itemid=53'; public $leading = []; public $primary = [0 => class stdClass { ... }, 1 => class stdClass { ... }, 2 => class stdClass { ... }, 3 => class stdClass { ... }, 4 => class stdClass { ... }, 5 => class stdClass { ... }, 6 => class stdClass { ... }, 7 => class stdClass { ... }, 8 => class stdClass { ... }, 9 => class stdClass { ... }]; public $secondary = []; public $links = []; public $params = class Joomla\Registry\Registry { protected $data = class stdClass { ... }; protected $initialized = TRUE; public $separator = '.' }; public $pagination = class Joomla\CMS\Pagination\Pagination { public $limitstart = 0; public $limit = 10; public $total = 15; public $prefix = ''; public $pagesStart = 1; public $pagesStop = 2; public $pagesCurrent = 1; public $pagesTotal = 2; public $hideEmptyLimitstart = FALSE; protected $viewall = FALSE; protected $additionalUrlParams = [...]; protected $app = class Joomla\CMS\Application\SiteApplication { ... }; protected $data = NULL }; public $item = class stdClass { public $id = '242'; public $title = 'mysql TO_DAYS(date) 函数'; public $alias = 'mysql-to_days-date-函数'; public $catid = '63'; public $published = '1'; public $introtext = 'TO_DAYS(date) 给定一个日期date, 返回一个天数 (从年份0开始的天数 )。 mysql&gt; SELECT TO_DAYS(950501); -&gt; 728779 mysql&gt; SELECT TO_DAYS(‘1997-10-07′); -&gt; 729669 TO_DAYS() 不用于阳历出现(1582)前的值,原因是当日历改变时,遗失的日期不会被考虑在内。 请记住, MySQL“日期和时间类型”中的规则将日期中的二位数年份值转化为四位。例如,&nbsp; ‘1997-10-07′和 ‘97-10-07′ 被视为同样的日期: mysql&gt; SELEC'; public $fulltext = ''; public $video = NULL; public $gallery = NULL; public $extra_fields = NULL; public $extra_fields_search = ''; public $created = '2012-01-04 10:21:39'; public $created_by = '63'; public $created_by_alias = ''; public $checked_out = '0'; public $checked_out_time = '0000-00-00 00:00:00'; public $modified = '2012-10-14 02:07:15'; public $modified_by = '0'; public $publish_up = '2012-01-04 10:21:11'; public $publish_down = '0000-00-00 00:00:00'; public $trash = '0'; public $access = '1'; public $ordering = '3'; public $featured = '0'; public $featured_ordering = '0'; public $image_caption = ''; public $image_credits = ''; public $video_caption = ''; public $video_credits = ''; public $hits = '3849'; public $params = class Joomla\Registry\Registry { ... }; public $metadesc = ''; public $metadata = ''; public $metakey = ''; public $plugins = ''; public $language = '*'; public $categoryname = 'MYSQL'; public $categoryid = '63'; public $categoryalias = 'mysql'; public $categoryparams = '{"inheritFrom":"0","theme":"","num_leading_items":"0","num_leading_columns":"1","leadingImgSize":"Large","num_primary_items":"10","num_primary_columns":"1","primaryImgSize":"Medium","num_secondary_items":"0","num_secondary_columns":"1","secondaryImgSize":"Small","num_links":"0","num_links_columns":"1","linksImgSize":"XSmall","catCatalogMode":"0","catFeaturedItems":"1","catOrdering":"","catPagination":"2","catPaginationResults":"1","catTitle":"1","catTitleItemCounter":"1","catDescription":"0","catImage":"0",'; public $itemGroup = 'primary'; public $category = class TableK2Category { ... }; public $link = '/item/242-mysql-to_days-date-函数.html'; public $printLink = '/item/242-mysql-to_days-date-函数.html?tmpl=component&amp;print=1'; public $tags = [...]; public $imageXSmall = ''; public $imageSmall = ''; public $imageMedium = ''; public $imageLarge = ''; public $imageXLarge = ''; public $rawTitle = 'mysql TO_DAYS(date) 函数'; public $author = class Joomla\CMS\User\User { ... }; public $text = 'TO_DAYS(date) 给定一个日期date, 返回一个天数 (从年份0开始的天数 )。 mysql&gt; SELECT TO_DAYS(950501); -&gt; 728779 mysql&gt; SELECT TO_DAYS(‘1997-10-07′); -&gt; 729669 TO_DAYS() 不用于阳历出现(1582)前的值,原因是当日历改变时,遗失的日期不会被考虑在内。 请记住, MySQL“日期和时间类型”中的规则将日期中的二位数年份值转化为四位。例如,&nbsp; ‘1997-10-07′和 ‘97-10-07′ 被视为同样的日期: mysql&gt; SELEC'; public $event = class stdClass { ... }; public $jcfields = [...]; public $image = ''; public $imageWidth = '400' } }, $method = 'display', $id = ???, $wrkarounds = ??? ).../BaseController.php:663
130.12653156368K2ViewItemlist->display( $tpl = ??? ).../ViewController.php:102
140.19796442776K2ViewItemlist->display( $tpl = NULL ).../view.html.php:1407
150.19796442776K2ViewItemlist->loadTemplate( $tpl = NULL ).../HtmlView.php:230
160.19926519600include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/category.php ).../HtmlView.php:701