分享
 
 
 

Installing MySQL on Solaris

王朝mssql·作者佚名  2006-01-30
窄屏简体版  字體: |||超大  

Installing MySQL on Solaris

Author: Jeff Hunter, ReWrited, Compiled by Lin Gang{lirincy@163.com}

Overview The following article provides the steps necessary to successfully install the binary version of MySQL, release 3.23, on Solaris 2.8 and higher. These procedures should work as well on versions of Solaris as early as version 2.6.

I typically install MySQL in /usr/local/mysql as the UNIX root account. I then create a UNIX mysql account that will have access to manage databases.

Once you've installed MySQL, you will need to initialize the grant tables, start the server, and make sure that the server works okay. You may also elect to arrange for the server to be started and stopped automatically when your system starts up and shuts down.

Installing the grant tables is accomplished by running the mysql_install_db script. This creates the mysql database which will hold all database privileges, the test database which you can use to test MySQL, and also privilege entries for the user that run mysql_install_db and a root user (without any passwords).

Operating System Account Create MySQL User Account:

% groupadd -g 116 mysql

% useradd -u 174 -c "MySQL Software Owner" -d /u01/app/mysql -g "mysql" -m -s /bin/bash mysql

% passwd mysql

Create MySQL UserID:

% mkdir /u01

% mkdir /u01/app

% mkdir /u01/app/mysql

% chown -R mysql:mysql /u01/app/mysql

Uncompress / Installing Binary Version of MySQL NOTE: Because of a bug in Solaris tar, Solaris users should use gnu tar to unpack archives.

% su -

% cp mysql-3.23.54-sun-solaris2.8-sparc.tar /usr/local

% cd /usr/local

% gunzip mysql-3.23.54-sun-solaris2.8-sparc.tar.gz

% gtar xvf mysql-3.23.54-sun-solaris2.8-sparc.tar

% ln -s mysql-3.23.54-sun-solaris2.8-sparc mysql

% cd mysql

% scripts/mysql_install_db

% chown -R root .

% chown -R mysql data

% chgrp -R mysql .

Starting and Stopping the MySQL Database Software Starting the MySQL Database

% bin/safe_mysqld --user=mysql &

Stopping the MySQL Database

% bin/mysqladmin -u root shutdown

Testing the Installation Ensure that the MySQL Software, the mysqld server, is running and you have set up the initial MySQL grant tables containing the privileges that determine how users are allowed to connect to the server. This is normally done with the mysql_install_db script.

* Using mysqladmin

% mysqladmin ping

mysqld is alive

% mysqladmin version

mysqladmin Ver 8.23 Distrib 3.23.54, for pc-linux on i686

Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB

This software comes with ABSOLUTELY NO WARRANTY. This is free software,

and you are welcome to modify and redistribute it under the GPL license

Server version 3.23.54

Protocol version 10

Connection Localhost via UNIX socket

UNIX socket /tmp/mysql.sock

Uptime: 59 min 45 sec

Threads: 1 Questions: 2 Slow queries: 0

Opens: 6 Flush tables: 1 Open tables: 0

Queries per second avg: 0.001

* Ensure you can shutdown and startup the server

Starting the MySQL Database

% bin/safe_mysqld --user=mysql &

Stopping the MySQL Database

% bin/mysqladmin -u root shutdown

or you can do like this:

To start or stop the server manually using the mysql.server script, invoke it with start or stop arguments:

shell> mysql.server start

shell> mysql.server stop

* Try several simple tests

% mysqlshow

+-----------+

| Databases |

+-----------+

| mysql |

| test |

+-----------+

% mysqlshow -u root mysql

Database: mysql

+--------------+

| Tables |

+--------------+

| columns_priv |

| db |

| func |

| host |

| tables_priv |

| user |

+--------------+

% mysql -u root -e "select host, db, user from db" mysql

+------+---------+------+

| host | db | user |

+------+---------+------+

| % | test | |

| % | test\_% | |

+------+---------+------+

% mysql -u root mysql

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 15 to server version: 3.23.54

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select host, db, user from db;

+------+---------+------+

| host | db | user |

+------+---------+------+

| % | test | |

| % | test\_% | |

+------+---------+------+

2 rows in set (0.00 sec)

Configuration Files / Scripts Example:

.bash_profile

$HOME/.bash_profile for the "mysql" user account.

Let MySQL runing automatically when system boot. % cp /usr/local/mysql/support-files/mysql.server /etc/init.d/

% ln -s /etc/init.d/mysql.server /etc/rc3.d/S98mysql

this will ensure that mysqld runing at boot time, make sure S##mysql the number should larger than the number of network services.

Use remote connection to use MySQL: 1、进入mysql,创建一个新用户xuys:

格式:grant 权限 on 数据库名.表名 用户@登录主机 identified by "用户密码";

grant select,update,insert,delete on *.* to xuys@192.168.88.234 identified by "xuys1234";

查看结果,执行:

use mysql;

select host,user,password from user;

可以看到在user表中已有刚才创建的xuys用户。host字段表示登录的主机,其值可以用IP,也可用主机名,

将host字段的值改为%就表示在任何客户端机器上能以xuys用户登录到mysql服务器,建议在开发时设为%。

update user set host = '%' where user = 'xuys';

2、 ./mysqladmin -uroot -ppwd reload

./mysqladmin -uroot -ppwd shutdown

3、./mysqld_safe --user=root &

记住:对授权表的任何修改都需要重新reload,即执行第3步。

如果经过以上3个步骤还是无法从客户端连接,请执行以下操作,在mysql数据库的db表中插入一条记录:

use mysql;

insert into db values('192.168.88.234','%','xuys','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');

update db set host = '%' where user = 'xuys';

重复执行上面的第2、3步。

同时, 你可以通过发出GRANT语句增加新用户:

shell> mysql --user=root mysql

mysql> GRANT ALL PRIVILEGES ON *.* TO monty@localhost

IDENTIFIED BY 'something' WITH GRANT OPTION;

mysql> GRANT ALL PRIVILEGES ON *.* TO monty@"%"

IDENTIFIED BY 'something' WITH GRANT OPTION;

mysql> GRANT RELOAD,PROCESS ON *.* TO admin@localhost;

mysql> GRANT USAGE ON *.* TO dummy@localhost;

接下来我们用Aqua DataStudio 来连接 MySQL数据库:

1. obtain AQUA from http://www.aquafold.com/downloads.html;

2. install.

3. Server|Register Server|General:

RDBMS: MYSQL

NAME: Lonshot MySQL database

TYPE: DEVELOPMENT

LOG IN NAME: sql

PASSWORD: ********

CONNECT AS: NORMAL

HOST: 11.11.11.11

Database: mysql

click OK

4. select Schema, right click mysql, select Query Analyzer.you can put sql statement now

References:

1.http://nnn.isblog.org/more.asp?name=sxysxy&id=72

2.http://www.linuxforum.net/books/mysqlmanual/manual_Privilege_system.html

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有