1.准备安装前的工作
创建mysql用户及用户组:
# groupadd -g 100 user
# useradd -m -g user -d /export/home/mysql mysql
然后以mysql用户登陆。
2.下载mysql安装文件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已经安装成功了。
3.配置开机启动脚本
修改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服务。
4.修改root用户密码:
# 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;
5. 常见错误
本地登录时出现错误:
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;
分享到:
相关推荐
mysq安装图解
mysq5.0l安装文件,mysql-gui-tools-5.0-r2-win32.msi。小巧玲珑在东西。
mysq高可用配置
windows下PHP5+APACHE+MYSQ完整配置.zip 有几个PHP模块代码。。。
mysq教程mysq教程mysq教程mysq教程mysq教程mysq教程mysq教程
数据库管理工具Navicat for MySQ 64
。。。
。。。
Ubuntu 12.04下如何安装MySQL ,我按照这文档,已经成功在ubuntu 12.04安装成功mysql!
mysq 优化方案+优化策略mysq 优化方案+优化策略mysq 优化方案+优化策略mysq 优化方案+优化策略mysq 优化方案+优化策略mysq 优化方案+优化策略mysq 优化方案+优化策略
Win10系统下MySQL 8.0.20安装和配置超详细教程 MySQL下载 MySQL直接去官网下载就行,选择community版本(免费)下载,链接。 在select operating system中选择Microsoft Windows,下方对应出现最新版本的MySQL,...
mysq开发包
mysql- my.ini配置(mysq5.6.10),供大家一起共同分享使用。
。。。
。。。
。。。
。。。
mysq常用函数字符串处理函数日期和时间函数常用的数值函数 CEIL(x)返回大于X的最大整数
JDBC连接mysq数据库Demo
mysq,sql,oraclel批处理脚本