mysql linux安装步骤:
1. make a directory, e.g,
cd /usr/local
mkdir mysql
2. cd /usr/local/mysql, then download from mysql.org,
you should select a compiled version,e.g http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.30-linux-x86_64-glibc23.tar.gz
e.g,
wget http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.30-linux-x86_64-glibc23.tar.gz
3. extract from compress file: tar -xzvf mysql-5.1.30-linux-x86_64-glibc23.tar.gz
4. rename mysql-5.1.30-linux-x86_64-glibc23 to your name, e.g, mv mysql-5.1.30-linux-x86_64-glibc23 run
5. begin to install step by step:
5.1. cd run
5.2. groupadd mysql # add a user who run mysqld
5.3. useradd -g mysql mysql
5.4. scripts/mysql_install_db --user=mysql #初始化权限
5.5. chown -R root . #更改当前目录得所有权
5.6. chown -R mysql data
5.7. chgrp -R mysql .
5.8. 运行mysql服务, bin/mysqld_safe --user=mysql &
5.9. 初始root没有密码,需要登录后,更改密码、配置用户
5.10. bin/mysql -u root
5.11. DELETE FROM mysql.user WHERE User = ''; #删除匿名用户
5.12. select Host,User,Password from mysql.user; #查看当前用户
5.13. SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');
SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('123456'); #配置用户密码
5.14. 开启远程客户端使用root访问权限: GRANT ALL ON *.* TO root@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
5.15. FLUSH PRIVILEGES; #刷新权限
5.16. ps aux|grep mysqld, 找到mysqld进程 id, kill -15 【pid】
5.17. cp support-files/my-large.cnf /etc/my.cnf
5.18. vi /etc/my.cnf, then try to find [mysqld], add "user=mysql" and "basedir=/usr/local/mysql/run", then save
5.19 cp support-files/mysql.server /etc/init.d/mysql
5.20. cd /etc/rc.d/init.d
5.21. chmod +x mysql
5.22. /sbin/chkconfig --del mysql
/sbin/chkconfig --add mysql # 保证能开机启动
5.23 ./mysql start
all is ok!!
分享到:
2010-12-23 16:47
浏览 532
评论