Go Back   Webmaster Malaysia Forum » Website Design & Development » Website Programming

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-09-2003, 02:49 PM
Novice Webmaster
 
Join Date: Sep 2003
Location: Kuala Lumpur
Posts: 10
Rep Power: 0
PrincessLea is on a distinguished road
Smile TCL/TK Scripting

Ada saper2 tak, yg tau pasal TCL/Tk ni.....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-09-2003, 09:56 AM
Novice Webmaster
 
Join Date: Sep 2003
Location: Kuala Lumpur
Posts: 10
Rep Power: 0
PrincessLea is on a distinguished road
Macam ni, saya tengah buat satu projek berkenaan document database, masalah skarang ni yelah, saya guna gabungan php, apache & mySQL, & tambahn TCL\TK script ni. sebelum install TCL/TK ni mmg x de masalah. saya boleh browse ke fail2 dlm apache. sampaila bila saya install TCL, & ubah skit conf file dlm apache, bila nak browse phpmyadmin, keluar la msg " Access denied for user 'root@localhost'(Using Password:NO)". sebab dah keluar msg tu yg buat saya tak dpt nak access mysql. so now ni saya mmg x tau nak buat mcm maner dah..adaer saper2 boleh tolong tak?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-09-2003, 03:44 PM
Senior Webmaster
 
Join Date: Oct 2001
Location: Melbourne, AU
Posts: 456
Rep Power: 95
sufyan is on a distinguished road
I don't know much about TCL/Tk scripting but I'v installed it before on a Linux system and Apache + MySQL worked fine after that, so I don't think that there should be a conflict between Apache and MySQL.

But, wat you can try is setting a root password for MySQL (details in reply to other post).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-09-2003, 01:16 PM
Novice Webmaster
 
Join Date: Sep 2003
Location: Kuala Lumpur
Posts: 10
Rep Power: 0
PrincessLea is on a distinguished road
I forgot to bring the TCL script, maybe u can view and find is there any errors that i made...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 08-09-2003, 02:04 AM
Novice Webmaster
 
Join Date: Sep 2003
Location: Kuala Lumpur
Posts: 10
Rep Power: 0
PrincessLea is on a distinguished road
Mr. Sufyan, ni dia coding TCL tu.
Saya dpt coding ni dr internet dan saya x paham
coding utk set root password.
Maybe problem saya tu punca nyerr dari situ..


#!/usr/bin/wish
#
# initdb.tcl

if {$tcl_platform(platform) == "windows"} {
load fbsql.dll
} else {
load fbsql.so
}
set props {titl 0 0 file 0 0 dirn 0 0 isdi 0 0 deep 0 0 crea 0 0 auth 1 0 proj 1 1 type 1 1 keyw 2 0 refe 0 0}


proc try_connect {user password} {
if {[catch {sql connect localhost $user $password} err]} {
if {[string match "*connect*" $err]} {
return connect
} else {
return pass
}
} else {
return ok
}
}

proc request_password {} {
global pass_entry pass_enter
set pass_entry ""
set pass_enter 0
label .label -text "Enter password for root :"
entry .entry -textvariable pass_entry
frame .frame
button .frame.enter -width 6 -text "OK" -command {set pass_enter 1}
button .frame.cancel -width 6 -text "cancel" -command {exit 0}
pack .label .entry .frame -side top -padx 5 -pady 5
pack .frame.enter .frame.cancel -side left -padx 5
tkwait variable pass_enter
destroy .label .entry .frame
return $pass_entry
}

proc request_new_password {} {
global pass_entry pass_enter
set pass_entry ""
set pass_enter 0
label .label -text "Enter a new password for root :"
entry .entry -textvariable pass_entry
frame .frame
button .frame.enter -width 6 -text "OK" -command {set pass_enter 1}
button .frame.cancel -width 6 -text "cancel" -command {exit 0}
pack .label .entry .frame -side top -padx 5 -pady 5
pack .frame.enter .frame.cancel -side left -padx 5
tkwait variable pass_enter
destroy .label .entry .frame
return $pass_entry
}

proc request_connection {} {
global pass_enter
set pass_enter 0
label .label -text "Check that mysql is running"
frame .frame
button .frame.enter -width 6 -text "OK" -command {set pass_enter 1}
button .frame.cancel -width 6 -text "cancel" -command {exit 0}
pack .label .frame -side top -padx 5 -pady 5
pack .frame.enter .frame.cancel -side left -padx 5
tkwait variable pass_enter
destroy .label .frame
}


proc init {} {
global props
set try "init"
set rootpass ""
set change_pass 0
set root_conn 0
while {$try != "ok"} {
set try [try_connect root $rootpass]
if {($try == "ok")&&($rootpass == "")} {
set change_pass 1
}
if {$try == "ok"} {
set root_conn 1
}
if {$try == "pass"} {
set try [try_connect db_user db_pass]
}
if {$try == "pass"} {
set rootpass [request_password]
} elseif {$try == "connect"} {
request_connection
}
}
if {$change_pass == 1} {
set new_pass [request_new_password]
sql selectdb mysql
sql "UPDATE user SET password=password('$new_pass') where user='root'"
}
if {$root_conn == 1} {
sql selectdb mysql
sql "DELETE FROM user WHERE user=''"
sql "DELETE FROM user WHERE user='db_user'"
sql "INSERT INTO user (Host, User, Password) VALUES('localhost', 'db_user', PASSWORD('db_pass'))"
sql "DELETE from db where user='db_user'"
sql "INSERT INTO db VALUES('localhost', 'documents_db', 'db_user', 'Y',
'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y')"
}
sql "drop database if exists documents_db"
sql "create database documents_db"
sql selectdb documents_db
foreach {prop proptype sublist} $props {
if {$sublist == 1} {
sql [format "create table %s (id int unsigned primary key auto_increment not null, opt varchar(30))" $prop]
sql [format "create table %s_2 (id int unsigned primary key auto_increment not null, opt varchar(30))" $prop]
}
}
sql "create table documents(id int unsigned primary key auto_increment not null,
titl varchar(80), dirn varchar(100), file varchar(60), deep int unsigned, isdi int, crea date,
auth varchar(80), refe varchar(50), proj int unsigned, type int unsigned, keyw varchar(80))"
sql "create table documents_2(id int unsigned primary key auto_increment not null,
titl varchar(80), dirn varchar(100), file varchar(60), deep int unsigned, isdi int, crea date,
auth varchar(80), refe varchar(50), proj int unsigned, type int unsigned, keyw varchar(80))"
sql "create table scan_dirs (id int unsigned primary key auto_increment not null,
dir varchar(100),mapto varchar(100))"
sql "insert into scan_dirs values (null, 'documents', 'documents')"
}
init
label .lab -text "Database initialised"
button .ok -text "ok" -command {exit 0}
pack .lab .ok -side top -padx 10 -pady 10
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 08-09-2003, 08:52 AM
Ben-davis's Avatar
Senior Webmaster
 
Join Date: Jan 2002
Location: SoObHanG JhaYa
Posts: 501
Rep Power: 93
Ben-davis is on a distinguished road
Send a message via ICQ to Ben-davis Send a message via Yahoo to Ben-davis
yup... kalau kat unix base platform, rasanya tadak problem la...
__________________
<form name="jump">
<select name="menu" onChange="location=document.jump.menu.options[document.jump.menu.selectedIndex].value;" style="border:1px #393F31 solid;color:#393F31;font:10px Verdana;font-weight:bold;" >
<option value="0" style="background: #9CC8FE" selected>*SELECT-LINKS</option>
<option value="http://www.gengturbo.org/" style="background: #FF0000">GENGTURBO</option>
<option value="http://www.phixelgrafix.com/" target="new" style="background: #C6D607">PHIXELGRAFIX</option>
<option value="http://dailydigital.phixelgrafix.com/" style="background: #FCBC45">OLD-BLOG</option>
<option value="http://www.mesrahosting.net/" style="background: #FF99CC">WEBHOSTING</option>
</select>
</form>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 08-09-2003, 04:10 PM
Senior Webmaster
 
Join Date: Oct 2001
Location: Melbourne, AU
Posts: 456
Rep Power: 95
sufyan is on a distinguished road
Well, I think you either:

1) Left the password blank or
2) Typed something wrong.

The script should work because of these lines:
if {$tcl_platform(platform) == "windows"} {
load fbsql.dll
which loads the tcl libraries

Anyway, I think it's safe to say that you have lost your root password. The only 2 thing I can think of is reinstalling MySQL or resetting the root password.

I would suggest you try resseting the password first, then if it doesn't work, you will have to reinstall MySQL. But, lets just hope that we can reset the mysql password. I'll try to make the steps as easy as possible to follow, but if you don't understand or have a question, please ask.

1) Ensure that the mysql deamon is loaded. From the MySQL bin directory, (eg. C:\mysql\bin) try typing
mysqladmin version
if it there is no error, mysql is loaded correctly. If theres an error, type
mysqld
from the came path and try to do the above again. If you cannoth find your bin directory, try using windows search to find the file: mysqladmin.exe

2) In the same directory as the mysqladmin.exe, type
mysql -u root
Some stuff should come out with 'mysql>'. If you see this, move on to step 3.

3) Type the following in mysql>, with an <ENTER> after each line. Ignore lines with # infront of them, these are just comments.
use mysql;
delete from user where user='root';
show fields from user;
insert into user values ('localhost', 'root', '', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', '', '', '', '', 0, 0, 0);
# the above is all on one line.
flush privileges;
exit
mysqladmin -u root -p shutdown
mysqld

That's it, this 'should' reset your mysql root password. When resetted, root has NO password. Now, just open up the config file for PhpMyAdmin and ensure that the user is 'root' and password is left blank.

If there are any errors, post them here. Also include your version of mySQL. I'm currently running 4.0.12-max-debug on WinXP. To find out your version, type mysqladmin version.

Hope this helps, good luck!

Last edited by sufyan; 08-09-2003 at 04:13 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 08-09-2003, 04:19 PM
Senior Webmaster
 
Join Date: Oct 2001
Location: Melbourne, AU
Posts: 456
Rep Power: 95
sufyan is on a distinguished road
Just curious, what do you use TCL/Tk for? If it's just to set a root password, using mysqladmin is much, much easier...

Quote:
Originally posted by Ben-davis
yup... kalau kat unix base platform, rasanya tadak problem la...
Yeah, I agree with Ben-davis, there are quite a few differences with the TCL library for windows compared to TCL on a UNIX system. There are some symbols, such as the backslash \, which does not work in windows, you'll have to use a forwardslash / or a double backslash \\.

Anyway, give the reset password thing a go and see what happens.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 08-09-2003, 06:27 PM
Novice Webmaster
 
Join Date: Sep 2003
Location: Kuala Lumpur
Posts: 10
Rep Power: 0
PrincessLea is on a distinguished road
i try it first..see what happen next. Actually, TCL tu saya guna utk initialised db for my document database.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 12-09-2003, 03:13 AM
sunshine's Avatar
Novice Webmaster
 
Join Date: Sep 2003
Location: KL
Posts: 14
Rep Power: 0
sunshine is on a distinguished road
i dah try, and its work. tq very much but i solve one problem by creating another problem..now ni I x boleh plak access mysql console...dia cakap cam ni " Access denied for user ODBC@localhost (Using Password: No)...tapi i malas nak pening2kan kepala, i reinstall phptriad and i settlekan create table barulah i continue buat TCL..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #11 (permalink)  
Old 12-09-2003, 03:59 AM
Novice Webmaster
 
Join Date: Sep 2003
Location: Kuala Lumpur
Posts: 10
Rep Power: 0
PrincessLea is on a distinguished road
Unhappy Sorry salah nick...

sorry saya tersalah guna nick...saya yg hantar guna nick sunshine tu, xkenal pun saper... biasalerr guna pc kat cc..dia x logout kut..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Freelance ASP,PHP,ASP.Net,C#,ColdFusion,Action Scripting Developer and SEO serviceatclick Job Vacancies 0 16-11-2006 07:06 AM
scripting for internal access hankitae Website Design 3 10-03-2005 05:52 PM



All times are GMT +8. The time now is 10:00 AM. Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.


WebmasterMalaysia.com is Proudly Hosted by Exabytes Semi Dedicated Server.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59