access denied for user ''#'localhost' error in xamp shell - xampp

I want to create a database in MySQL using command line. so I use shell option in xampp to create it.
I write this line
create database abc;
access denied for user #'localhost' to database abc;

Related

Psql \i <file name> How to get around the permission denied error when reading from a file on Windows 10?

Operating system: Windows 10
Database: Postgres 13
When trying to execute an sql file mydatabase=>\i C:\tmp\sqlfile.sql I get a
C:: Permission denied
error. The file permissions have been set to read / write for all. No matter where I put the file, bin directory, public directory, tmp directory, I get the same error.
I have created a user bill and log in as Bill, and I still get the same error. The '\' has been replaced with '/' with no success. The postgres account does not work either.
Is there a system setting that needs to be set to allow Postgres to read a file?

how to connect to multiple oracle databases of different servers via shell script

I want to connect to multiple (30) oracle databases which resides in different servers (27) via shell script and fetch details from each database. I have a user (test) created on all databases but the details I want to fetch needs sysdba privileges. In my environment, I cannot provide DBA privs to any other user due to limitations. Hence my idea is to connect to each database using sqlplus -s "$user/$password#$tnsentry" and then connect as sysdba to fetch details.
Though I am able to connect to all databases using test, the "connect as sysdba" is getting executed on current database in current server.
My script:
cat tmp/db.par | while read LINE
do
if [ -n "$LINE" ] ; then
tns_entry=$LINE
export tns_entry
sqlplus -s /nolog >> $tmp/query.log <
exit
sqlconn
fi
done
In the tns_entry loop, I have given ABC,DEF,GHI,JKL,MNO databases to get details from and I am running this query from a server where database XYZ resides. I didn't give XYZ in my loop and didn't connect to database but the query results are from XYZ database. Please help me on this.
Thank you!
You should connect as sysdba
add "as sysdba" in the script and try.
conn sys/password#tnsentry as sysdba

database logical full backup export using expdp

I wrote the following commands:
create directory orcl_full as '/oradata3/datapump/full_export';
create user user1 identified by admin12;
grant read,write on directory orcl_full to user1;
grant exp_full_database to user1;
But when I tried exporting data using expdp command, it did not work:
expdp user1#ri/admin12#ORCL directory=orcl_full dumpfile=orclfull.dmp logfile=full_export.log FULL=YES;
Here is the error I get:
ORA-31626: job does not exist
ORA-31633: unable to create master table "user1.SYS_EXPORT_FULL_05"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
ORA-06512: at "SYS.KUPV$FT", line 1048
ORA-01950: no privileges on tablespace 'USERS'
I am stuck here, can someone kindly help me. In the tutorials, this command was working.
ORA-31626: job does not exist
ORA-31633: unable to create master table
Datapump uses a master table to manage the export job. Like any other table it needs storage which means it needs to write to a tablespace.
ORA-01950: no privileges on tablespace 'USERS'
When you created user1 account you did not grant it any tablespace privileges. So it cannot create any tables and that's why the job fails. The solution is quite simple: grant quota on the USERS tablespace (the default tablespace if no other is specified for the user account).
alter user user1 quota unlimited on users;
"got the following error :SP2-0734: unknown command beginning "expdp use..." - rest of line ignored. "
expdp is an OS executable. Your error is a SQL*plus error, which is a SQL client. Either fire up a terminal window and run the OS command there, or shell out from SQL*Plus using the host command.
This command worked :
expdp user1#ri15/$d_pass directory=orcl_full dumpfile=orclfull.dmp logfile=full_export.log FULL=YES;`

Which are the proper privileges to mysqldump for the Error Access denied when executing 'SELECT INTO OUTFILE'.?

backup user has BackupAdmin role and ALL privileges (object rights, DDL, GRANT).
cmd> mysqldump --routines=TRUE --tab=C:\tmp -h localhost -u backup -pbackup schemalocal
cmd> mysqldump: Got error: 1045: Access denied for user 'backup'#'%' (using password: YES) when executing 'SELECT INTO OUTFILE'
The only way to make it work is to give DBA role to backup account, but that is a security risk so I want to give it only the neccesary rights.
Which are them?
You need the FILE privilege in order to be allowed to use SELECT...INTO OUTFILE, which seems to be what mysqldump --tab uses to generate the tab-separated dump.
This privilege is global, which means it may only be granted "ON *.*" :
GRANT FILE ON *.* TO 'backup'#'%';

Should CONNECT work in SQL*PLUS script?

I'd like to run a sqlplus script from a cron job.
I thought I could put a line like:
CONNECT "myuser/mypass#mydb"
within the script and then just execute it with:
sqlplus #myscript
However, when I do so, I get:
SP2-0306: Invalid Option
SP3-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
Am I misunderstanding the usage of the connect command?
When running CONNECT inside SQL*Plus, remove the quotes:
CONNECT myuser/mypass#mydb
They double quotes are required if you are passing the credentials as an argument to sqlplus:
sqlplus "myuser/mypass#mydb"
, for the shell to parse myuser/mypass#mydb as a single argument if you have spaces in your connection identifier or use additional options like AS SYSDBA.
Use the /NOLOG option.
sqlplus /nolog #myscript
Oracle 11gR2
I ran a .sql file via SQL*Plus connected initially as JOHN. Within the file I connect as SYS and then run a GRANT. See .sql file contents below:
connect sys/password as sysdba
GRANT EXECUTE ON DBMS_CRYPTO TO JOHN;
connect JOHN/DOE
NOTE: I don't recommend keeping the sys/password in a text file btw.
HTH

Resources