平台实施文档6数据库安装配置手册MySQL For SuSE Linux 100Word格式文档下载.docx
《平台实施文档6数据库安装配置手册MySQL For SuSE Linux 100Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《平台实施文档6数据库安装配置手册MySQL For SuSE Linux 100Word格式文档下载.docx(12页珍藏版)》请在冰豆网上搜索。
5.删除匿名用户
删除匿名用户,执行“deletefrommysql.userwhereuser='
'
;
”再执行flushprivileges;
然后查看现有用户。
图5
6.添加新用户
添加新用户,执行“GRANTALLPRIVILEGESON*.*TO'
sinoiact'
@'
localhost'
IDENTIFIEDBY'
password'
WITHGRANTOPTION;
”和“GRANTALLPRIVILEGESON*.*TO'
%'
”。
然后再查看用户显示如下:
图6
7.服务参数配置
启动服务:
servicemysqlstart
停止服务:
servicemysqlstop或者mysqladminshutdown–uroot–proot
同时,根据medium的配置得到环境参数:
/var/lib/mysql/f,如下。
#ThefollowingoptionswillbepassedtoallMySQLclients
[client]
default-character-set=gbk
#password=your_password
port=3306
socket=/var/lib/mysql/mysql.sock
#Herefollowsentriesforsomespecificprograms
#TheMySQLserver
[mysqld]
default-storage-engine=INNODB
max_connections=80
skip-locking
key_buffer=16M
max_allowed_packet=1M
table_cache=64
sort_buffer_size=512K
net_buffer_length=8K
read_buffer_size=256K
read_rnd_buffer_size=512K
myisam_sort_buffer_size=8M
#Don'
tlistenonaTCP/IPportatall.Thiscanbeasecurityenhancement,
#ifallprocessesthatneedtoconnecttomysqldrunonthesamehost.
#AllinteractionwithmysqldmustbemadeviaUnixsocketsornamedpipes.
#NotethatusingthisoptionwithoutenablingnamedpipesonWindows
#(viathe"
enable-named-pipe"
option)willrendermysqlduseless!
#
#skip-networking
#ReplicationMasterServer(default)
#binaryloggingisrequiredforreplication
log-bin=mysql-bin
#requireduniqueidbetween1and2^32-1
#defaultsto1ifmaster-hostisnotset
#butwillnotfunctionasamasterifomitted
server-id=1
#ReplicationSlave(commentoutmastersectiontousethis)
#
#Toconfigurethishostasareplicationslave,youcanchoosebetween
#twomethods:
#1)UsetheCHANGEMASTERTOcommand(fullydescribedinourmanual)-
#thesyntaxis:
#CHANGEMASTERTOMASTER_HOST=<
host>
MASTER_PORT=<
port>
#MASTER_USER=<
user>
MASTER_PASSWORD=<
password>
;
#whereyoureplace<
<
byquotedstringsand
#<
bythemaster'
sportnumber(3306bydefault).
#Example:
#CHANGEMASTERTOMASTER_HOST='
125.564.12.1'
MASTER_PORT=3306,
#MASTER_USER='
joe'
MASTER_PASSWORD='
secret'
#OR
#2)Setthevariablesbelow.However,incaseyouchoosethismethod,then
#startreplicationforthefirsttime(evenunsuccessfully,forexample
#ifyoumistypedthepasswordinmaster-passwordandtheslavefailsto
#connect),theslavewillcreateamaster.infofile,andanylater
#changeinthisfiletothevariables'
valuesbelowwillbeignoredand
#overriddenbythecontentofthemaster.infofile,unlessyoushutdown
#theslaveserver,deletemaster.infoandrestarttheslaverserver.
#Forthatreason,youmaywanttoleavethelinesbelowuntouched
#(commented)andinsteaduseCHANGEMASTERTO(seeabove)
#requireduniqueidbetween2and2^32-1
#(anddifferentfromthemaster)
#defaultsto2ifmaster-hostisset
#butwillnotfunctionasaslaveifomitted
#server-id=2
#Thereplicationmasterforthisslave-required
#master-host=<
hostname>
#Theusernametheslavewilluseforauthenticationwhenconnecting
#tothemaster-required
#master-user=<
username>
#Thepasswordtheslavewillauthenticatewithwhenconnectingto
#themaster-required
#master-password=<
#Theportthemasterislisteningon.
#optional-defaultsto3306
#master-port=<
#binarylogging-notrequiredforslaves,butrecommended
#log-bin=mysql-bin
#Pointthefollowingpathstodifferentdedicateddisks
#tmpdir=/tmp/
#log-update=/path-to-dedicated-directory/hostname
#UncommentthefollowingifyouareusingBDBtables
#bdb_cache_size=4M
#bdb_max_lock=10000
#UncommentthefollowingifyouareusingInnoDBtables
innodb_data_home_dir=/var/lib/mysql/
innodb_data_file_path=ibdata1:
10M:
autoextend
innodb_log_group_home_dir=/var/lib/mysql/
innodb_log_arch_dir=/var/lib/mysql/
#Youcanset.._buffer_pool_sizeupto50-80%
#ofRAMbutbewareofsettingmemoryusagetoohigh
innodb_buffer_pool_size=16M
innodb_additional_mem_pool_size=2M
#Set.._log_file_sizeto25%ofbufferpoolsize
innodb_log_file_size=5M
innodb_log_buffer_size=8M
innodb_flush_log_at_trx_commit=1
innodb_lock_wait_timeout=50
[mysqldump]
quick
max_allowed_packet=16M
[mysql]
no-auto-rehash
#RemovethenextcommentcharacterifyouarenotfamiliarwithSQL
#safe-updates
[isamchk]
key_buffer=20M
sort_buffer_size=20M
read_buffer=2M
write_buffer=2M
[myisamchk]
[mysqlhotcopy]
interactive-timeout
8.创建数据库
创建数据库sinoiact,执行“CREATEDATABASEsinoiactDEFAULT
CHARACTERSETgbkDEFAULT
COLLATEgbk_chinese_ci;
然后显示所有数据库如下:
图7
到此,在linux上创建数据库完毕。
接下来,在客户端PC上使用MySQLAdministrator进行相关操作
图8
9.给用户赋予权限
登录后,选择UserAdministration,在下面选中sinoiact用户,在右边选中sinoiact数据库,再给它完全的权限(把所有的availableprivileges都加到assignedprivileges中)。
图9
10.建表及加载初始化数据
然后在客户PC上,执行附件中的脚本:
sinoiact_mysql.cmd来建表及加载初始化数据,选择Catalogs的SchemaTables,点击Refresh,显示如下
图10
到此,在SuSELinux上MySQL的安装、配置、建库、建表、导入初始化数据、连接、测试已经完成。
相关说明:
关于建表和加载初始化数据的附件脚本,不同的环境下,只需要编辑sinoiact_mysql.cmd即可:
将IP该换成MySQLServer所在的服务器IP,-u和-p后面所对应的是数据库sinoiact的用户的用户名和密码。
注意事项:
1、安装MySQL前,应关闭linux系统自带防火墙,否则在PC上会出现MySQLAdministrator连接错误(10060)。
2、在Linux中,库名是区分大小写的。
所以使用useSinoiact是不可以的,必须使用usesinoiact。
相关网站:
1、MySQL镜象地址:
http:
//mysql.justdn.org/downloads/mysql/5.0.html
2、Server下载地址:
//mysql.justdn.org/Downloads/MySQL-5.0/MySQL-server-standard-5.0.27-0.sles9.i586.rpm
3、Client下载地址:
//mysql.justdn.org/Downloads/MySQL-5.0/MySQL-client-standard-5.0.27-0.sles9.i586.rpm