Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8316855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:27:06+00:00 2026-06-08T21:27:06+00:00

I wrote a script and I keep getting the following errors. access denied for

  • 0

I wrote a script and I keep getting the following errors. access denied for user ‘zul’@’localhost (using password:yes) when trying to connect

proj: 43: [d: not found

proj: 43: [d: not found

It’s not reading the input d nor is it connecting to MySQL. Any Ideas?

Here is my Script:

#!/bin/bash

tstamp=$(date +$s) 

#Dump or Update
if [ -z "$1" ]; then
  echo -n "What do you want to do? [D]ump or [U]pdate: "
  read parm
else
  parm=$1
fi

#Database Name
if [ -z "$2" ]; then
  echo -n "What database are you using?"
  read dbname
else
  dbname=$2
fi

#Database User
if [ -z "$3" ]; then
  echo -n "What database user are you using?"
  read dbuser
else
  dbuser=$3
fi

#Database Password
if [ -z "$4" ]; then
     echo -n "What password are you using?"
     read dbpass
else
     dbpass=$4
fi


#Checks if the directory exists
if test ! -d "/home/zul/sql/backup"; then
  mkdir /home/zul/sql
  mkdir /home/zul/sql/backup
fi

mysqldump $dbuser -p$dbpass $dbname > /home/zul/sql/backup/$tstamp.$dbname.sql

if [$parm = d ]; then
  mysqldump $dbuser -p$dbpass $dbname > /home/zul/sql/backup/$dbname.sql
elif [$parm = u ]; then
  mysqldump $dbuser -p$dbpass $dbname < /home/zul/sql/backup/$dbname.sql
else
  echo " d or u option only! (lower case)"
fi
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T21:27:08+00:00Added an answer on June 8, 2026 at 9:27 pm

    I guess there is a space missing in your if-else test:
    Should be [ test ] and not [test ]

    if [ $parm = d ]; then
      mysqldump $dbuser -p$dbpass $dbname > /home/zul/sql/backup/$dbname.sql
    elif [ $parm = u ]; then
      mysqldump $dbuser -p$dbpass $dbname < /home/zul/sql/backup/$dbname.sql
    else
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a Python script that does some task to generate, and then keep
I am trying to write a custom script that will keep a list of
I wrote a script parsing a .csv file in groovy using tokenize, which ended
I wrote a script using Ruby to click on the screen automatically on Windows's
I'm trying to write a Python script to open a URL, but I keep
I wrote some script in a site. The script makes a new spreadsheet and
I wrote this script which counts occurrences of particular pattern in a given file.
I wrote a script that uses xcodebuild to generate an AdHoc build of an
I wrote this script to for a contact form on my website, everything works
I have wrote a script to detect when I reach the div element which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.