Install mysql-5.0.45.tar.gz (This package: http://www.filewatcher.com/m/mysql-5.0.45.tar.gz.24433261-0.html)
# groupadd MySQL #添加mysql组
# useradd-g MySQL MySQL #添加mysql用户, and join MySQL Group
--------------------the compilation process----------------------------------
# tar zxvf mysql-5.0.45.tar.gz #解压后在当前目录下ls下, the mysql-5.0.45 directory appears
# CD mysql-5.0.45 #进入解压后的mysql目录
#./configure--prefix=/usr/local/mysql--with-charset=utf8--with-collation=utf8_general_ci--with-extra-charsets= Latin1
#--prefix=/usrlocal/mysql is the directory where the MySQL installation is made
#--with-charset=utf8--with-collation=utf8_general_ci is set MySQL default character set to UTF8
#--with-extra-charsets=latin1 set the character set that the server needs to support
In the./configure procedure, if error occurs:
Checking for termcap functions Library ... configure:error:No curses/termcap Library found
Cause: Missing ncurses installation package
Redhat/centos Series
# yum List|grep ncurses #查看系统是否安装了ncurses
# yum-y installs Ncurses-devel #我的系统中缺少ncurses-devel, so just install the plugin on the line.
Ubuntu or Debian series
# Apt-cache Search ncurses #检查系统中ncurses
# apt-get Install Libncurses5-dev#安装ncurses-devel plug-in
Once this plugin is installed, once again:
#./configure--prefix=/usr/local/mysql--with-charset=utf8--with-collation=utf8_general_ci--with-extra-charsets= Latin1 will succeed configure.
# makes && make install installs, installs longer, can sip tea ...
---------------the installation completed successfully--------------------------------------
# CP support-files/my-medium.cnf/etc/my.cnf #从mysql -5.0.45 directory to copy the configuration file to/etc directory and rename it to MY.CNF
# vi/etc/my.cnf #将log-bin=mysql-bin Comment out
Log-bin=mysql-bin is MySQL log function, installed MySQL, after running for a period of time, in the MySQL directory appears a bunch of similar mysql-bin.000***, It has been lined up from mysql-bin.000001 and takes up a lot of hard disk space, up to dozens of G. If you don't want these logs, comment them out.
------------------Initial configuration of MySQL----------------------------------
# Cd/usr/local/mysql #进入mysql的安装目录下
# bin/mysql_install_db--user=mysql #初始化mysql
# Chown-r Root. #更改当前目录拥有者为root. Note that there is a "." Behind Root. Meaning for the current directory
# chown-r Mysql/usr/local/mysql #改变目录所属为mysql
# Bin/mysql_safe--user=mysql & #在后台启动mysql
# bin/mysqladmin-uroot Password 123456 #在mysql首次正常启动情况下, change the root user login password
# bin/mysql-uroot-p #输入此命令后, press ENTER will display let you enter the root password
mysql> show databases; #show一下你所有的数据库.
Mysql> quit; #退出mysql
-------------------add MySQL to the system service------------------------
# Cp/usr/local/mysql/share/mysql/mysql.server/etc/init.d/mysqld
This can be restarted by/etc/init.d/mysqld Start|stop|restart MYSQLL
or service mysqld start|stop|restart|status restart MySQL or check the status of MySQL service
------------------Configure the MySQL environment variable------------------------------
# echo Export path= $PATH:/usr/local/mysql/bin >>/etc/profile
This allows you to use MySQL directly mysql-uroot-p123456, without having to switch to the MySQL installation directory to use MySQL.
-------------------enable remote access for the root user---------------------
# mysql-uroot-p #进入mysql
Mysql> Grant All on * * to [e-mail protected] '% ' identified by ' 123456 ';
#grant permissions on the database name. Table name to user @ Login host identified by "User password"
The last default database directory is/usr/local/mysql/var
So the simple installation of MySQL completed, specific in-depth can be self-study under the research ...
This article is from the "handwriting" blog, please be sure to keep this source http://icekina.blog.51cto.com/5911953/1420980