mysql
本次主要记录Linux下Mysql-5.5.23的源码安装记录文档。
安装环境:
操作系统:CentOS 6.2
数据库:MYSQL 5.5.23
虚拟机:VMWARE 8.0.2
步骤主要有:
1.下载mysql源码安装包
地址:http://www.mysql.com/downloads/mysql/#downloads,选择的platform为source code,我这次选的是5.5.23版本
2.环境的配置
下 载到服务器上后,会发现与之前版本的安装有所区别,之前是使用的./configure来配置的,但是本次下载的版本已经没有了,但是多了几个cmake 文件,查看相关文档得知,已经取代了之前的configure检查安装。所以环境中需要安装cmake包,当然gcc等关键安装包是必须的。
本次下载的cmake版本是cmake-2.8.3.tar.gz。
cmake的安装:
#tar xvf cmake-2.8.3.tar.gz
#cd cmake-2.8.3
#./bootstrap
#gmake
#gmake install
3.用户配置
#groupadd mysql
#useradd mysql -g mysql
4.mysql的安装(root下)
# tar xvf mysql-5.5.23.tar.gz
# cd mysql-5.5.23
# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/usr/local/mysql -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306
过程如下:
– MySQL 5.5.23
– Packaging as: mysql-5.5.23-Linux-x86_64
– Configuring done
– Generating done
– Build files have been written to: /home/mysql/mysql-5.5.23
敲cmake命令时将上述命令弄成一行回车。
编译及安装等
# make
# make install
# cd support-files/
# cp my-large.cnf /etc/my.cnf
# cp mysql.server /etc/init.d/mysqld
初始化DB
# /usr/local/mysql/scripts/mysql_install_db –defaults-file=/etc/my.cnf –basedir=/usr/local/mysql –datadir=/usr/local/mysql/data –user=mysql
最后结果如下:
Installing MySQL system tables…
OK
Filling help tables…
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/local/mysql/bin/mysqladmin -u root password ‘new-password’
/usr/local/mysql/bin/mysqladmin -u root -h localhost.localdomain password ‘new-password’
Alternatively you can run:
/usr/local/mysql/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysql/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/local/mysql/scripts/mysqlbug script!
5.配置my.cnf
修改/etc/my.cnf文件,新增如下内容:
#added by kenyon 20120418 about the log para
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock
log-bin=/usr/local/mysql/log/mysql-bin
# expire_logs_days = 30
# max_binlog_size = 500M
log=/usr/local/mysql/log/mysql.log
log-error=/usr/local/mysql/log/error.log
long_query_time=2
log-slow-queries=/usr/local/mysql/log/slowquery.log
# log-queries-not-using-indexes=/usr/local/mysql/log/nouseindex.log
[mysqld_safe]
datadir=/usr/local/mysql/data/
6.授权
# chown -R mysql /usr/local/mysql/data
# mkdir /usr/local/mysql/log
# chown -R mysql /usr/local/mysql/log
7.启动与关闭
启动:
/usr/local/mysql/bin/mysqld_safe &
[mysql@localhost log]$ mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.23-log Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> select version();
+————+
| version() |
+————+
| 5.5.23-log |
+————+
1 row in set (0.00 sec)
在/etc/init.d/mysqld新增
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
完了,该文件除了启动和关闭也可以有其他用处
启动:/etc/init.d/mysqld start
关闭:/etc/init.d/mysqld stop
重载:/etc/init.d/mysqld reload/force-reload
状态:/etc/init.d/mysqld status
Making a Slideshow-type MPEG1 Video with GNU/Linux
http://linuxgazette.net/153/bhaaluu.html
Making a Slideshow-type MPEG1 Video with GNU/Linux
By bhaaluu
This tutorial is for users who are interested in making an MPEG1 video using GNU/Linux and Free Open Source Software. The process described is partly automated with bash shell scripts, but otherwise still relies on handcrafting the video frame by frame. You are expected to know how to compile and install files from source code, use The Gimp, and use Audacity. The tutorial will describe when these tools are to be used. A total of six frames are used to make the video. One is a simple blank screen, filled with black. Two frames require using The Gimp’s Text Tool. Three images are used as slides. The Gimp is used to scale those images to fit a specific image size. Audacity is used to edit sound for the video.
Software Tools:
- ImageMagick
- mpeg2encode
- The Gimp
- Audacity
- ffmpeg
- ffplay
- bash shell scripts:
- make_mpeg2encode_parfile
- duplicateFile
- fade
From ImageMagic, the ‘convert’ and ‘mogrify’ utilities will be used. ‘convert’ needs mpeg2encode in order to make an MPEG1 video. mpeg2encode can be obtained from: http://www.mpeg.org/MPEG/MSSG/. You’ll need to compile and install it on your computer.
The Gimp is used to make the black screens, title screen, and credits screens.
Audacity is a sound editor, used to edit the sound clips for the video. Audacity exports different audio file formats, such as WAV, MP3, or Ogg Vorbis.
ffmpeg is a computer program that can record, convert, and stream digital audio and video in numerous formats.
ffplay is a video player.
Shell scripts are used to automate repetitive tasks, using variables and ‘while’ loops. The make_mpeg2encode_parfile script creates a parameter file for the mpeg2encode program.
In this tutorial, we’ll make a slideshow-type video. Several slides will fade in and fade out in sequence. An animation sequence could easily be substituted for the slideshow.
It is very helpful to keep the video project organized, so the first thing to do is create a new directory:
$ mkdir newVideo
Next, create several subdirectories in the newVideo/ directory:
[newVideo]$ mkdir 00black1001-1010 01title1011-1110 02video1111-1410 03credi1411-1510 04black1511-1520 05makeVideo originals
These subdirectories will each hold a different set of files. The numbers are the number of frames for each set. This video will have a total of 520 frames. The first ten frames will be black. The title screen will have 100 frames. The video slideshow will have 300 frames. The credit screen will have 100 frames. Finally, there will be ten frames of black at the end.
Use a digital camera to take several photos, then download the photos from the camera to your computer. After the photos are on the computer, edit them in The GIMP, scaling all the photos so they fit in a 640×480 image size. Fill in any space around the image with black. Notes:
- Many movie-making methods expect the image size in x and y to be in multiples of 16. If not, depending on the version of mpeg_encode, they will either resize the images, core dump, or complain and not create the video.
- mpeg2encode expects the files to be numbered sequentially. A correct numbering sequence is: file0000.jpg, file0001.jpg, …, file1000.jpg. An incorrect sequence is: file1, …, file10, …, file100 (because using the wildcard symbol (*) will not sort them correctly).
- Even though the various MPEG encoders can generate movies with various frame sizes, not all viewers can handle them. The best approach is to stick with either 640×480 or 320×240.
- Keep your frames uncluttered, especially if you are creating a movie with small frames (e.g. 320 x 240 movie).
- Avoid thin lines, dark blue lines on a black background, highly saturated colors, small objects, etc.
- Start with a good image. Any compression scheme will degrade the quality of the original.
- Don’t create your frames using the GIF file format. GIF compresses the color information to 256 colors. MPEG does not have this restriction.
These notes were taken from this HOWTO.
Save the digital photos as image0001.ppm, image0002.ppm, and image0003.ppm in the newVideo/ directory. PPM is an uncompressed image file that works well with mpeg2encode.
While you’re in The GIMP, make a 640×480 blank image. Fill this with black and save it as blackScrn.ppm. Next, create the title screen, using the Text tool. Make the title screen with white letters on a black background and save it as titleScrn.ppm. Finally, create a credits screen with a black background and white letters, and save it as crediScrn.ppm.
This slideshow video will be made of these files:
blackScrn.ppm titleScrn.ppm image0001.ppm image0002.ppm image0003.ppm crediScrn.ppm
The screens will be resized to 320×240, so make the text large enough to read after the screens have been resized. To resize the images, use the convert utility:
$ convert -size 640x480 blackScrn.ppm -resize 320x240 00blackScrn.ppm
$ convert -size 640x480 titleScrn.ppm -resize 320x240 01titleScrn.ppm
$ convert -size 640x480 image0001.ppm -resize 320x240 02image0001.ppm
$ convert -size 640x480 image0002.ppm -resize 320x240 02image0002.ppm
$ convert -size 640x480 image0003.ppm -resize 320x240 02image0003.ppm
$ convert -size 640x480 crediScrn.ppm -resize 320x240 03crediScrn.ppm
$ convert -size 640x480 blackScrn.ppm -resize 320x240 04blackScrn.ppm
Move these working files to their respective subdirectories – i.e.,
[newVideo]$ mv 00blackScrn.ppm 00black1001-1010/
[newVideo]$ mv 01titleScrn.ppm 01title1011-1110/
[newVideo]$ mv 02image000?.ppm 02video1111-1410/
[newVideo]$ mv 03crediScrn.ppm 03credi1411-1510/
[newVideo]$ mv 04blackScrn.ppm 04black1511-1520/
Move the remaining original files to originals/.
[newVideo]$ mv *.ppm originals/
The next step is to duplicate the various files in each directory. This is where a bash shell script comes in handy.
#!/bin/bash
############################################################################
#name: duplicateFile
#date: 2008-06-20
############################################################################
if [ $# -ne 4 ]
then
echo "Usage: `basename $0` begin_range end_range filename duplicate"
exit 1
fi
# $1 is beginning of range
let num=$1
# $2 is end of range
while [ ${num} -le $2 ]
do
# $3 is filename
# $4 is duplicate
cp $3 $4${num}.ppm
num=$(($num+1))
done
############################################################################
If you put this script in your /home/bin directory, you will be able to execute it from any directory you are in – assuming your /home/bin directory is in your PATH, and you have made the file executable. To put your /home/user/bin directory in your PATH, add this to the .bash_profile file in your home directory:
# set PATH so it includes user's private bin if it exists
if [ -d ~/bin ] ; then
PATH=~/bin:"${PATH}"
fi
Then make the script that is in the ~/bin directory, executable:
[bin]$ chmod u+x duplicateFile
This tutorial expects that the scripts are in the PATH.
Usage of this script requires the beginning and end numbers of the range of numbers that you want to duplicate, the name of the original file you want to duplicate, and the name of the duplicate file. The script adds the sequential number to the name of the file, so all that is needed is the name.
Change to the 00black1001-1010/ subdirectory and execute this command:
[00black1001-1010]$ duplicateFile 1001 1010 00blackScrn.ppm frame
The script creates frame1001.ppm to frame1010.ppm. Remove 00blackScrn.ppm.
[00black1001-1010]$ rm 00blackScrn.ppm
Change to the 01title1011-1110 subdirectory and repeat the steps you did above, changing the numbers appropriately.
[00black1001-1010]$ cd ../01<TAB> (Use TAB completion.)
[00black1001-1010]$ duplicateFile 1011 1110 01titleScrn.ppm frame
[02video1111-1410]$ rm 01title.ppm
Next, change to the 02video1111-1410/ subdirectory and do the same thing to each image file in the directory. Each file, in this case, will be duplicated 100x.
[01title1011-1110]$ cd ../02<TAB> (Use TAB completion.)
[02video1111-1410]$ duplicateFile 1111 1210 02image0001.ppm frame
[02video1111-1410]$ duplicateFile 1211 1310 02image0002.ppm frame
[02video1111-1410]$ duplicateFile 1311 1410 02image0003.ppm frame
[02video1111-1410]$ rm 02image0*.ppm
In the 03credi1411-1510/ directory:
[03credi1411-1510]$ duplicateFile 1411 1510 03crediScrn.ppm frame
[03credi1411-1510]$ rm 03crediScrn.ppm
In the 04black1511-1520/ directory:
[04black1511-1520]$ /duplicateFile 1511 1520 04blackScrn.ppm frame
[00black1001-1010]$ rm 04blackScrn.ppm
That completes making all the needed files for the slideshow video. The next step is to make some transitions between the various screens. In this tutorial you’ll create a fade in/fade out effect. Here is the script that does it:
#!/bin/bash
############################################################################
#name: fade
#date: 2008-06-20
############################################################################
if [ $# -ne 3 ]
then
echo "Usage: `basename $0` in|out filename fileNumber"
exit 1
fi
if [ $1 = "in" ]
then
num=$3
count=1
while [ $count -le 25 ]
do
fadein=$(($count*4))
mogrify $2$num.ppm -modulate $fadein $2$num.ppm
count=$(($count+1))
num=$(($num+1))
done
fi
if [ $1 = "out" ]
then
num=$3
count=1
while [ $count -le 25 ]
do
fadeout=$(($count*4))
mogrify $2$num.ppm -modulate $fadeout $2$num.ppm
count=$(($count+1))
num=$(($num-1))
done
fi
############################################################################
These are the commands to do the work:
[newVideo]$ cd ../01title1011-1110/
[01title1011-1110]$ fade in frame 1011
[01title1011-1110]$ fade out frame 1110
[01title1011-1110]$ cd ../02video1111-1410/
[02video1111-1410]$ fade in frame 1111
[02video1111-1410]$ fade out frame 1210
[02video1111-1410]$ fade in frame 1211
[02video1111-1410]$ fade out frame 1310
[02video1111-1410]$ fade in frame 1311
[02video1111-1410]$ fade out frame 1410
[02video1111-1410]$ cd ../03credi1411-1510/
[03credi1411-1510]$ fade in frame 1411
[03credi1411-1510]$ fade out frame 1510
The above commands fade the title, each slide, and the credits in and out. The black screens at the beginning and end of the video don’t need the fade-in, fade-out effect.
Now copy all the PPM files in each subdirectory to 05makeVideo/.
[newVideo]$ cp 00black1001-1010/*.ppm 05makeVideo/
[newVideo]$ cp 01title1011-1110/*.ppm 05makeVideo/
[newVideo]$ cp 02video1111-1410/*.ppm 05makeVideo/
[newVideo]$ cp 03credi1411-1510/*.ppm 05makeVideo/
[newVideo]$ cp 04black1511-1520/*.ppm 05makeVideo/
After copying the files, you should have 520 files in 05makeVideo/.
[newVideo]$ ls 05makeVideo/ | wc -l
520
This version of the tutorial relies on a new bash script which can be found at this website. Change to 05makeVideo and run the make_mpeg2encode_parfile script. This script makes the parameter file that mpeg2encode relies on.
[newVideo]$ cd 05makeVideo/
[05makeVideo]$ make_mpeg2encode_parfile frame*.ppm
The make_mpeg2encode_parfile script takes the names of the frames as a parameter and creates the mpeg2encode.par file. Next, edit mpeg2encode.par in your favorite plain text editor (vi, right?):
lines
2. frame%4d /* name of source files */
7. 2 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */
8. 520 /* number of frames */
9. 1 /* number of first frame */
13. 1 /* ISO/IEC 11172-2 stream (0=MPEG-2, 1=MPEG-1)*/
14. 0 /* 0:frame pictures, 1:field pictures */
15. 320 /* horizontal_size */
16. 240 /* vertical_size */
17. 8 /* aspect_ratio_information 1=square pel, 2=4:3, 3=16:9, 4=2.11:1 */
18. 3 /* frame_rate_code 1=23.976, 2=24, 3=25, 4=29.97, 5=30 frames/sec. */
Line 2 is the name of the source file, plus space for four numbers.
Line 7 is 2 because of the PPM files.
Line 8 should be the number of frames in the video.
Line 9 is the number of the first frame.
Line 13 is 1 because it is a MPEG1 video.
Line 14 is 0, for frame pictures.
Lines 15 and 16 are the size of the frames in the video.
Line 17 is 8. I don’t know why. It works.
Line 18 is 3 for 25fps. This works well for the popular video upload sites.
Next, run mpeg2encode to make the video:
[05makeVideo]$ mpeg2encode mpeg2encode.par video.mpg
Don’t worry about the overflow and underflow errors.
The video plays at 25 frames per second. There are 520 frames in the video, so it lasts a little over 20 seconds. The first 4 seconds are the title screen. The last 4 seconds are the credits screen. That leaves about 12 seconds of slideshow screens.
Use Audacity to edit a sound file. You can make your own, or find a free sound clip on the Internet and use it.
[05makeVideo]$ audacity your_sound_file.ogg
In Audacity, generate 4 seconds of silence before the slideshow, and 4 seconds of silence after the slideshow. Audacity allows you to fade-in and fade-out the sound, as well as copy-paste it, delete sections of it, and so forth. When finished editing the sound file, export it as an Ogg Vorbis file, saved to the 05makeVideo/ directory: sound.ogg
Finally, add the sound to the video with this command:
[05makeVideo]$ ffmpeg -i sound.ogg -s 320x240 -i video.mpg finishedVideo.mpg
It’s time to watch the finished video!
[05makeVideo]$ ffplay finishedVideo.mpg
If you like it, create an account on YouTube, or another video site, upload your video, and share it with the world! You should now have a good idea of how to create your own customized slideshow- type video, with fade-in, fade-out effects and sound, using free, open source software. Here is an example of this type of slideshow video on YouTube.
给 Android 国行手机安装 Google Play 商店
最近偶入手一台三星国行 Android 手机,这货将 Google 相关应用剔除得一干二净。鉴于之前使用安卓市场安装到被注入了酷仔广告的游戏,遂萌发了要使用 Google Play 商店的决心。在此略记加装 Google Play 商店以及实现付费购买应用的过程,希望对类似遭遇的同学有用。
安装 Google Play 商店
- 首先要 root 手机。这个可以请教 Google 大神,毕竟不同的手机型号,在 root 方法上会略有差异。我是利用深度刷机拿到了 root 权限。如果不行,你可以多试试其他类似工具。
- 准备 Google Play 商店依赖包。如果单纯安装 Google Play 商店,经常出现闪退现象,总之无法正常使用。这是因为 Google Play 需要一些依赖包方能正常运行。从 http://goo.im/gapps/ 可以下载到适合自己 Android 版本的 Google 应用包。解压后从中复制 GoogleServicesFramework.apk、GoogleLoginService.apk (在 system/app 目录下)到手机 SD 卡备用。
- 从手机默认市场安装 Root Explorer 和 Google Play 商店。
- 执行 Root Explorer,将第 2 步的依赖包复制到手机的 /system/app 目录;同时将第 3 步安装的 Google Play 商店(在手机的 /data/app 目录下,名称为 com.android.vending-1.apk)也移动到该位置。
- 重启手机。注意这一步很重要,重启时将出现升级系统应用的进度条。
至此,加装 Google Play 商店的过程完成,如果不出意外的话,应该可以正常使用了。
实现 Google Play 商店付费购买
- 到 Google 电子钱包绑定信用卡。绑定成功后发卡银行会有预扣款授权的短信提醒。注意在绑定时是没有中国这项选择的,可以选择其他区域代替,我选择的是香港。
- 在手机上安装市场解锁(Market Unlcoker)用于伪装区域,可设定好某个美国区域。
- 在手机上安装 AppCobber 这个 VPN,每月可免费使用 3 小时,你也可以选择其他 VPN 代替。
- 开动 VPN,执行 Google Play 商店就可购买付费应用了。
http://linuxtoy.org/archives/ffdiaporama-1-5.html
haxe
http://www.cnblogs.com/xiaotie/archive/2012/04/19/2456447.html
http://www.mhtml5.com/2011/10/3214.html