# CentOS-Media.repo # # This repo can be used with mounted DVD media, verify the mount point for # CentOS-6. You can use this repo and yum to install items directly off the # DVD ISO that we release. # # To use this repo, put in your DVD and use it with the other repos too: # yum --enablerepo=c6-media [command] # # or for ONLY the media repo, do this: # # yum --disablerepo=\* --enablerepo=c6-media [command]
[c6-media] name=CentOS-$releasever - Media baseurl=file:///mnt/cd gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
select * from mobile_order_region where school_id=6921 into outfile '/tmp/6921.txt'
方法二:导出时直接设置字符集格式:
1 2 3 4 5 6 7 8 9
mysql> select * from mobile_order_region where school_id=6921 into outfile '/tmp/6921.csv' CHARACTER SET gbk FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n'; Query OK, 6888 rows affected (0.11 sec)
mysql> select concat_ws('#','dbdh=','NorthEastTrcoon',null) AS dbdh_name_three; +-----------------------+ | dbdh_name_three | +-----------------------+ | dbdh=#NorthEastTrcoon | +-----------------------+ 1 row in set (0.00 sec)
例2:
1 2 3 4 5 6 7 8
mysql> select concat_ws(null,'dbdh=','NorthEastTrcoon',null) AS dbdh_name_fourth ; +------------------+ | dbdh_name_fourth | +------------------+ | NULL | +------------------+ 1 row in set (0.00 sec)
例3:
1 2 3 4 5 6 7
mysql> select concat_ws('*','dbdh=','NorthEastTrcoon',null) AS dbdh_name_fifth; +-----------------------+ | dbdh_name_fifth | +-----------------------+ | dbdh=*NorthEastTrcoon | +-----------------------+ 1 row in set (0.00 sec)
MySQL中group_concat函数 完整的语法如下: group_concat([DISTINCT] 要连接的字段 [Order BY ASC/DESC 排序字段] [Separator ‘分隔符’])
基本查询
1 2 3 4 5 6 7 8 9 10 11 12
mysql> select * from stu1; +------+------+ | id| name | +------+------+ |1 | 10| |1 | 20| |1 | 20| |2 | 20| |3 | 200 | |3 | 500 | +------+------+ 6 rows in set (0.00 sec)
以id分组,把name字段的值打印在一行,逗号分隔(默认)
1 2 3 4 5 6 7 8 9
mysql> select id,group_concat(name) from aa group by id; +------+--------------------+ | id| group_concat(name) | +------+--------------------+ |1 | 10,20,20| |2 | 20 | |3 | 200,500| +------+--------------------+ 3 rows in set (0.00 sec)
以id分组,把name字段的值打印在一行,分号分隔
1 2 3 4 5 6 7 8 9
mysql> select id,group_concat(name separator ';') from aa group by id; +------+----------------------------------+ | id| group_concat(name separator ';') | +------+----------------------------------+ |1 | 10;20;20 | |2 | 20| |3 | 200;500 | +------+----------------------------------+ 3 rows in set (0.00 sec)
以id分组,把去冗余的name字段的值打印在一行,
逗号分隔
1 2 3 4 5 6 7 8 9
mysql> select id,group_concat(distinct name) from aa group by id; +------+-----------------------------+ | id| group_concat(distinct name) | +------+-----------------------------+ |1 | 10,20| |2 | 20 | |3 | 200,500 | +------+-----------------------------+ 3 rows in set (0.00 sec)
以id分组,把name字段的值打印在一行,逗号分隔,以name排倒序
1 2 3 4 5 6 7 8 9
mysql> select id,group_concat(name order by name desc) from aa group by id; +------+---------------------------------------+ | id| group_concat(name order by name desc) | +------+---------------------------------------+ |1 | 20,20,10 | |2 | 20| |3 | 500,200| +------+---------------------------------------+ 3 rows in set (0.00 sec)
还有一个简单的连接方式为: ||
1 2 3 4 5 6 7 8 9
mysql> select * from student; +----+------+-------+----------+------------+ | id | age | score | name | birth | +----+------+-------+----------+------------+ | 1 | 23 | 78 | 李四 | 2017-10-10 | | 2 | 24 | 78 | zhangsan | 2017-10-10 | | 3 | 25 | 99 | 王五 | 2016-05-17 | +----+------+-------+----------+------------+ 3 rows in set (0.00 sec)
zeroconf (Zero configuration networking), is a techniques that automatically creates a usable Internet Protocol (IP) network without manual operator intervention or special configuration servers. 169.254.0.0/255.255.0.0 route is part of zeroconf under RHEL 6 / CentOS 6 or older versions. To see current routing table, enter:
1
# route -n
Sample outputs:
1 2 3 4 5 6 7 8
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 74.8x.4y.zz 0.0.0.0 255.255.255.248 U 0 0 0 eth1 10.10.29.64 0.0.0.0 255.255.255.192 U 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 1003 0 0 eth1 10.0.0.0 10.10.29.65 255.0.0.0 UG 0 0 0 eth0 0.0.0.0 74.8x.yy.zz 0.0.0.0 UG 0 0 0 eth1
Every time the server or Linux desktop boots, the zeroconf route 169.254.0.0 is enabled and added to the kernel routing table. To disable zeroconf route under RHEL / CentOS / Fedora Linux, enter:
1
# vi /etc/sysconfig/network
Append the following directive:
NOZEROCONF=yes Save and close the file. Reboot the system / server or restart the networking service:
Oracle VirtualBox is a cross-platform virtualization application. It installs on your existing Intel or AMD-based computers, whether they are running Windows, Mac, Linux or Solaris operating systems. It extends the capabilities of your existing computer so that it can run multiple operating systems at the same time. Click here to read more about VirtualBox
Oracle has released VirtualBox 5.1.14 maintenance release of VirtualBox 5.1 on January 17th, 2017. In this release VirtualBox has improves stability and fixes regressions. To read more about this release read changelog.
This article will help you to install Oracle VirtualBox 5.1 on CentOS, Redhat and Fedora systems using Yum.
Step 1 – Add Required Yum Repositories
Firstly you are required to add VirtualBox yum repository in your system. Download repository file from its official site and place it under at __ /etc/yum.repos.d/virtualbox.repo __ .First navigate to /etc/yum.repos.d/ directory and use one of below commands as per your operating system.
1 2 3 4 5 6 7
# cd /etc/yum.repos.d/
For CentOS/RHEL Systems: # wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo
For Fedora Systems: # wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo
__ CentOS/RHEL __ Users also need to add EPEL yum repository using one of the following commands.
1 2 3 4 5 6
CentOS/RHEL 7, 64 Bit (x86_64): # rpm -Uvh http://epel.mirror.net.in/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
CentOS/RHEL 6, 64 Bit (x86_64): # rpm -Uvh http://epel.mirror.net.in/epel/6/x86_64/epel-release-6-8.noarch.rpm
Step 2 – Install Required Packages
Before installing VirtualBox make sure to install all required packages to run VirtualBox like kernel-headers, kernel-devels etc. Use the following command to install required packages.
VirtualBox installation required kernel source code to install required modules, So we need to configure environment variable __ KERN_DIR __ to which VirtualBox get kernel source code. In my case latest kernel source is available in ** 2.6.32-504.3.3.el6.x86_64 ** directory under ** /usr/src/kernels/ **. Make sure you are using correct source path.
Use the following command to install VirtualBox 5.1 using yum command line tool. It will install the latest version of VirtualBox 5.1.x on your system.
1
# yum install VirtualBox-5.1
After installation, we need to rebuild kernel modules using the following command.
1
sudo /usr/lib/virtualbox/vboxdrv.sh setup
Step 5 – Start VirtualBox
Use following command to start VirtualBox from X windows. You can switch to GUI mode using ** init 5 ** or ** startx ** commands from terminal.
lapommedeMacBook-Pro:~ lapomme$ sudo dd if=/linux.dmg of=/dev/rdisk2 bs=1m 2934+1 records in 2934+1 records out 3076767744 bytes transferred in 149.567568 secs (20571089 bytes/sec)
$ cat /etc/tmpfiles.d/tmp.conf # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version.
# See tmpfiles.d(5) for details
# Clear tmp directories separately, to make them easier to override D /tmp 1777 root root 0 D /var/tmp 1777 root root 10d
# Exclude namespace mountpoints created with PrivateTmp=yes x /tmp/systemd-private-* x /var/tmp/systemd-private-* X /tmp/systemd-private-*/tmp X /var/tmp/systemd-private-*/tmp