[b]步骤:[/b]
shell>cp mysql-5.1.43-linux.tar.gz /home
shell>cd /home
shell>tar -zxvf mysql-5.1.43-linux.tar.gz
shell>cp /home/mysql-5.1.43-linux-i686-glibc23/support-files/my-medium.cnf /etc/my.cnf
shell>scripts/mysql_install_db --user=mysql
shell>bin/mysqld_safe &
#更改密码bin/mysqladmin -u root password 'admin'
#登陆bin/mysql -u root -p
Enter password:
mysql>
[b]开机启动mysql:[/b]
shell>cp /home/mysql-5.1.43-linux-i686-glibc23/support-files/mysql.server /etc/init.d/mysql
shell>cd /etc/init.d
shell>vi mysql
把basedir改为basedir=/home/mysql-5.1.43-linux-i686-glibc23
把datadir改为datadir=/home/mysql-5.1.43-linux-i686-glibc23/data
把$bindir/safe_mysqld --datadir=$datadir --pid-file=$pid_file &
改为--datadir=$datadir后面加个--user=root
shell>chkconfig --add mysql
#chkconfig --level 2345 mysqld on
#chkconfig mysqld on ← 设置MySQL服务随系统启动自启动
#chkconfig --list mysqld ← 确认MySQL自启动
[b]修改命令别名[/b]
为了不每次进入mysql都要输入/home/mysql-5.1.43-linux-i686-glibc23/bin/mysql -u root -p
shell>alias homemysql='/home/mysql-5.1.43-linux-i686-glibc23/bin/mysql -u root -p'
如果alias的路径输入错误直接改为正确的路径重新alias就可以,其它都一样
启动后直接输入homemysql就可以
shell>cp mysql-5.1.43-linux.tar.gz /home
shell>cd /home
shell>tar -zxvf mysql-5.1.43-linux.tar.gz
shell>cp /home/mysql-5.1.43-linux-i686-glibc23/support-files/my-medium.cnf /etc/my.cnf
shell>scripts/mysql_install_db --user=mysql
shell>bin/mysqld_safe &
#更改密码bin/mysqladmin -u root password 'admin'
#登陆bin/mysql -u root -p
Enter password:
mysql>
[b]开机启动mysql:[/b]
shell>cp /home/mysql-5.1.43-linux-i686-glibc23/support-files/mysql.server /etc/init.d/mysql
shell>cd /etc/init.d
shell>vi mysql
把basedir改为basedir=/home/mysql-5.1.43-linux-i686-glibc23
把datadir改为datadir=/home/mysql-5.1.43-linux-i686-glibc23/data
把$bindir/safe_mysqld --datadir=$datadir --pid-file=$pid_file &
改为--datadir=$datadir后面加个--user=root
shell>chkconfig --add mysql
#chkconfig --level 2345 mysqld on
#chkconfig mysqld on ← 设置MySQL服务随系统启动自启动
#chkconfig --list mysqld ← 确认MySQL自启动
[b]修改命令别名[/b]
为了不每次进入mysql都要输入/home/mysql-5.1.43-linux-i686-glibc23/bin/mysql -u root -p
shell>alias homemysql='/home/mysql-5.1.43-linux-i686-glibc23/bin/mysql -u root -p'
如果alias的路径输入错误直接改为正确的路径重新alias就可以,其它都一样
启动后直接输入homemysql就可以