`

mysql-5.1.61-linux-x86_64-glibc23.tar.gz 安装笔记

阅读更多
1、建立mysql用户组,mysql用户,并且把mysql用户加入到mysql用户组中。  
建立mysql用户组:groupadd mysql  
建立mysql用户并加入mysql用户组:useradd mysql -g mysql -p mysql123456 -s /sbin/nologin -M  
说明:-g 是加入到mysql用户组,-p是设置密码,-s是设置shell,这里设置的是不让其登录,-M就是不建立用户目录。
 
2、把按照文件拷贝到:/usr/local/mysql,  
用的命令是cp –rf mysql-5.1.61-linux-x86_64-glibc23.tar.gz /usr/local/mysql ,  
然后到目录/usr/local/mysql下面解压缩文件:tar -zxvf mysql-5.1.61-linux-x86_64-glibc23.tar.gz


3、到mysql目录下,初始化mysql表,安装 mysql 默认数据库:
cd /usr/local/mysql  
[root@localhost mysql]# scripts/mysql_install_db --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:

./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

Alternatively you can run:
./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 . ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl

Please report any problems with the ./bin/mysqlbug script!

即说明安装成功。

4、修改目录权限,如下:
[root@localhost mysql]# cd ..
[root@localhost local]# chgrp -R mysql mysql  
[root@localhost local]# chown -R mysql mysql/data  

5、添加到系统自启动,如下:  
[root@localhost local]# cp mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld  
-- 添加到系统自启动
[root@localhost local]# chkconfig --add mysqld   
 
6、启动mysql服务进程,如下:  
[root@localhost local]# /etc/init.d/mysqld start  
7、查看mysql是否启动命令
a:启动完成查看mysql状态,命令: /etc/rc.d/init.d/mysqld status,看看m y s q l 是否已经启动.
[root@localhost local]# /etc/rc.d/init.d/mysqld status
SUCCESS! MySQL running (32508)
b: ps -aux | grep mysqld
c:netstat -tl | grep mysql
8、初次登陆mysql 并修改root 密码及设置可连接 主机
-- 默认密码为空

[root@localhost tmp]# /usr/local/mysql/bin/mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

---------如果出现这个问题则需修改 /etc/my.cnf 文件在文件中mysql.sock路径修改正确,注意[mysqld] 和 [mysql] 都需要配置 mysql.sock路径
重启mysql

[root@localhost local]#/usr/local/mysql/bin/mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.1.61 MySQL Community Server (GPL)

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> use mysql;

---修改root 默认密码
update user set password=PASSWORD("adMin") where host='localhost' and user='root'
delete from user where password ='';
--设置可连接 主机; % 所有都可连接
update user set host='%' where host='localhost' and user='root'

9、退出重启mysql
[root@localhost local]#/etc/init.d/mysqld stop
[root@localhost local]#/etc/init.d/mysqld start

10、其他配置待续。。。。。。。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics