我需要在所有表的所有列中执行这些语句。
alter table table_name charset=utf8;
alter table table_name alter column column_name charset=utf8;
Run Code Online (Sandbox Code Playgroud)
是否可以在 MySQL 中以任何方式自动执行此操作?我宁愿避免 mysqldump
更新:Richard Bronosky 向我展示了方式:-)
我需要在每个表中执行的查询:
alter table DBname.DBfield CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
Run Code Online (Sandbox Code Playgroud)
生成所有其他查询的疯狂查询:
SELECT distinct CONCAT( 'alter table ', TABLE_SCHEMA, '.', TABLE_NAME, ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;' ) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = 'DBname';
Run Code Online (Sandbox Code Playgroud)
我只想在一个数据库中执行它。一口气执行所有操作花费的时间太长。事实证明,它为每个表的每个字段生成一个查询。每个表只需要一个查询(与救援不同)。在文件上获取输出是我实现它的方式。
如何生成输出到文件:
mysql -B -N --user=user --password=secret -e "SELECT distinct CONCAT( 'alter table ', TABLE_SCHEMA, '.', TABLE_NAME, ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;' …
Run Code Online (Sandbox Code Playgroud) 我在 phpMyAdmin 版本的主页上收到此错误:3.2.1deb1 已停用使用链接表的附加功能。要了解原因,请单击此处。 当我点击链接时,我得到了这份报告。
$cfg['Servers'][$i]['pmadb'] ... OK
$cfg['Servers'][$i]['relation'] ... not OK [ Documentation ]
General relation features: Disabled
$cfg['Servers'][$i]['table_info'] ... not OK [ Documentation ]
Display Features: Disabled
$cfg['Servers'][$i]['table_coords'] ... not OK [ Documentation ]
$cfg['Servers'][$i]['pdf_pages'] ... not OK [ Documentation ]
Creation of PDFs: Disabled
$cfg['Servers'][$i]['column_info'] ... not OK [ Documentation ]
Displaying Column Comments: Disabled
Bookmarked SQL query: Disabled
Browser transformation: Disabled
$cfg['Servers'][$i]['history'] ... not OK [ Documentation ]
SQL history: Disabled
$cfg['Servers'][$i]['designer_coords'] ... not OK [ …
Run Code Online (Sandbox Code Playgroud) 我在 slicehost 上运行网络服务器并决定删除未使用/不必要的用户。但我真的不知道哪些是系统运行所必需的
我将它用作带有 mysql、php、memcached、ssh 和 proftpd 的 apache 网络服务器。
这是 /etc/passwd 中的用户列表。
我如何决定要删除哪些?
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
libuuid:x:100:101::/var/lib/libuuid:/bin/sh
sshd:x:101:65534::/var/run/sshd:/usr/sbin/nologin
MYUSER:x:1000:1000:,,,:/home/MYUSER:/bin/bash
mysql:x:102:105:MySQL Server,,,:/var/lib/mysql:/bin/false
Debian-exim:x:103:106::/var/spool/exim4:/bin/false
ftp:x:104:65534::/home/ftp:/bin/false
logcheck:x:105:107:logcheck system account,,,:/var/lib/logcheck:/bin/false
proftpd:x:107:65534::/var/run/proftpd:/bin/false
Run Code Online (Sandbox Code Playgroud) 我正在尝试在 debian Lenny 中安装最新版本的 maatkit。我找不到最新版本的存储库,所以我得到了 .deb 文件。问题是如何安装这个文件?man aptitude 没有给我任何线索。
存储库将是理想的解决方案。如果你知道一个带有 php 5.3 的存储库,那就加分了