Chinaunix首页 | 论坛 | 博客
  • 博客访问: 198906
  • 博文数量: 69
  • 博客积分: 1400
  • 博客等级: 上尉
  • 技术积分: 720
  • 用 户 组: 普通用户
  • 注册时间: 2005-08-03 11:35
文章分类

全部博文(69)

文章存档

2011年(13)

2010年(46)

2009年(10)

我的朋友

分类: Mysql/postgreSQL

2009-12-16 14:12:31

MySql 091216: Install(2/2)

@ http://zcatt.cublog.cn

Prepare

MySql 5.1.39

 

1.    Post-installation

1) mysql_install_db program sets up the grant tables. If you install by RPM, it is runned automatically.

 

2) use mysqladmin to verify the server is running.

 

mysqladmin version

mysqladmin variables

mysqladmin ping

mysqladmin –u root shutdown

mysql_safe –user=mysql –log &

mysqlshow

2. install mysql.server manually

1) copy mysql.server to /etc/init.d, and rename as mysql. Make it executable

 

cp mysql.server /etc/init.d/mysql

chmod +x /etc/init.d/mysql

 

2) Set mysql service to run automatically at sys startup

 

chkconfig --add mysql

or

chkconfig --level 345 mysql on

 

3) Config /etc/my.cnf file

The sections are read by script in my.cnf, see the table.

Script

Option Groups

[mysqld], [server], [mysqld-major_version]

[mysqld], [server], [mysqld_safe]

[mysqld], [mysql.server], [server]

 

4) if err,  you can check the log files,  host_name.err and host_name.log

 

tail host_name.err

tail host_name.log

 

3. Securing the accounts

2) The initial root passwd is empty.  One root account is for localhost, one is for actual host name and IP number.

 

1) Two anonymous-user accounts are created initally without passwd initially.

 

mysql -u root

SET PASSWORD FOR ‘’@’localhost’ = PASSWORD(‘newpwd’);

SET PASSWORD FOR ‘’@’host_name’ = PASSWORD(‘newpwd’);

 

or remove the anonymous users

 

mysql -u root

DROP USER ‘’;

 

2) The initial root passwd is empty.  One root account is for localhost, one is for actual host name and IP number.

 

mysql -u root

SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘newpwd’);

SET PASSWORD FOR ‘root’@’hostname’=PASSWORD(‘newpwd’);

 

or

 

mysqladmin -u root password “newPwd”

mysqladmin -u root -h host_name password “newpwd”

 

or

 

mysql -u root

update mysql.user set password=PASSWORD(‘newpwd’) where user =’root’;

flush privileges;

 

 

阅读(1070) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~