Solaris 10下Mysq安装及配置

[b][size=large]1.准备安装前的工作[/size][/b]
创建mysql用户及用户组:
# groupadd -g 100 user
# useradd -m -g user -d /export/home/mysql mysql

然后以mysql用户登陆。
[b][size=large]2.下载mysql安装文件[/size][/b]mysql-5.1.36-solaris10-i386.tar.gz到安装目录(如/export/home/mysql/works/)
解压文件:

# chmod +x mysql-5.1.36-solaris10-i386.tar.gz (添加执行权限)
# gzip -d mysql-5.1.36-solaris10-i386.tar.gz
# tar -xvf mysql-5.1.36-solaris10-i386.tar

安装初始数据库:
# cd works/mysql/scripts/
# ./mysql_install_db --user=mysql

此时有可能会报错

FATAL ERROR: Could not find ./bin/my_print_defaults

If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.

If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.

重新执行命令,添加basedir及datadir参数:

# ./mysql_install_db --user=mysql --basedir=/export/home/mysql/works/mysql
--datadir=/export/home/mysql/works/mysql/data/

执行成功。到此,Mysql已经安装成功了。
[size=large][b]
3.配置开机启动脚本[/b][/size]

修改support-files/mysql.server文件,添加basedir及datadir,然后将mysql.server文件复制到想要的位置如/etc/init.d/mysqld
# cp mysql.server /etc/init.d/mysqld

这样,启动、停止mysql服务的脚本为
# /etc/init.d/mysqld start | stop | restart [--user=mysql]
(按以上方式安装后user默认为mysql)

可以在/etc/rc3.d/目录下建立开机启动脚本,文件名需要以“S”开头,然后跟数字,后面为自定义名字,如S86mysqlserv。文件内容为:
#!/sbin/sh
/etc/init.d/mysqld start

这样,当计算机重启后即可启动mysql服务。
[size=large][b]
4.修改root用户密码:[/b][/size]
# mysqladmin -u root password root (修改root用户的密码为root)

以命令行方式登录mysql:
#  mysql -u root -p

修改用户权限:
mysql> grant all PRIVILEGES on orion_expo.* to 
orion@'localhost' identified by '123456';

orion_expo 表示上面的权限是针对于哪个表的,orion_expo 指的是数据库,若为所有的则用*表示。由此可以推理出:对于全部数据库的全部表授权为“*.*”,对于某一数据库的全部表授权为“数据库名.*”,对于某一数据库的某一表授权为“数据库名.表名”。
orion@'localhost' 前面的orion表示你要给哪个用户授权,这个用户可以是存在的用户,也可以是不存在的用户。
  localhost 表示允许远程连接的 IP 地址,如果想不限制链接的 IP 则设置为“%”即可。
  123456 为用户的密码。
mysql> flush privileges; 

[b]
[size=large]5. 常见错误[/size][/b]

本地登录时出现错误:
ERROR 1251: Client does not support authentication 
protocol requested by server; consider upgrading MySQL client

这是因为客户端支持的mysql版本过低了,解决办法有以下两种:
(1)
mysql> SET PASSWORD FOR ‘some_user'@'some_host' = 
OLD_PASSWORD('newpwd');

(2)
mysql> UPDATE mysql.user SET Password = 
OLD_PASSWORD('newpwd') WHERE Host = 'some_host' AND User = 'some_user';
mysql> FLUSH PRIVILEGES;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值