Create Anonymous user without password in mysql8 - mysql-8.0

I need to create a anonymous user without password in mysql8
I run following command to create:
mysql> create user ''#'localhost';
ERROR 1396 (HY000): Operation CREATE USER failed for ''#'localhost'
I flush privileges
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
Again I used create user command and this time getting different error:
mysql> create user ''#'localhost';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

Related

How to add a superuser privilege to a postgres user

I can't add a superuser privilege to a new db through this command:
alter user postgres with superuser
I get this error:
Failed to run sql query: must be superuser to alter superuser roles or change superuser attribute
I ran the command in Supabase SQL Editor.
I ran the command successfully in a db that I created a month ago with the result:
Success. No rows returned
Let me know where I am going wrong.

Wrong ORDS_PUBLIC_USER password ORDS 22.1

I'm trying to install ORDS 22.1.1 on Oracle 19c db.
I get error:
ORA-20202: ERROR: An error occurred during "ORDS_PUBLIC_USER" creation.
ORA-28003: password verification for the specified password failed
ORA-06512: at line 65
There is INFO that it occurs in [*** script: ords_create_rest_users.sql].
There is a c_xxx constant varchar2(100) := to_char(****)
This password doesn't pass the database password policy.
While I'm trying to install ORDS it didn't ask me for password for ORDS_PUBLIC_USER.
Furthemore I can't find the script ords_create_rest_users.sql (even after unziping ords.war) to check how he create the password.
Yeah, its strange that it doesnt ask for password for those users anymore and have no direct control over it. but the solution(or say workaround) is to disable the complex password verification temporarily while install and then enable it again.
Disable the password verification:
SQL> alter profile default limit password_verify_function null;
Install ORDS.
Re-Enable the the password verification:
SQL> alter profile default limit password_verify_function <verify_function_name>;
you can get <verify_function_name> from below query for DEFAULT profile:
SQL> select limit from dba_profiles where profile='DEFAULT' and resource_name='PASSWORD_VERIFY_FUNCTION';

SP2-0606: Cannot create SPOOL file

I use Oracle 12c R2 on Windows 10 pro x64. I get sample script by
cd E:\github.com\oracle
git clone https://github.com/oracle/db-sample-schemas.git
in CMD
E:\github.com\oracle\db-sample-schemas\human_resources>sqlplus sys/summer as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 28 11:15:24 2017
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> #hr_main.sql
specify password for HR as parameter 1:
Enter value for 1: 123456
specify default tablespeace for HR as parameter 2:
Enter value for 2: hr_tablespace
specify temporary tablespace for HR as parameter 3:
Enter value for 3: hr_temp_tablespace
specify password for SYS as parameter 4:
Enter value for 4: summer
specify log path as parameter 5:
Enter value for 5: C:\vy\
specify connect string as parameter 6:
Enter value for 6: localhost:1521/orcl
SP2-0606: Cannot create SPOOL file "C:\vy\hr_main.log"
DROP USER hr CASCADE
*
ERROR at line 1:
ORA-01918: user 'HR' does not exist
CREATE USER hr IDENTIFIED BY 123456
*
ERROR at line 1:
ORA-65096: invalid common user or role name
ALTER USER hr DEFAULT TABLESPACE hr_tablespace
*
ERROR at line 1:
ORA-01918: user 'HR' does not exist
ALTER USER hr TEMPORARY TABLESPACE hr_temp_tablespace
*
ERROR at line 1:
ORA-01918: user 'HR' does not exist
GRANT CREATE SESSION, CREATE VIEW, ALTER SESSION, CREATE SEQUENCE TO hr
*
ERROR at line 1:
ORA-01917: user or role 'HR' does not exist
GRANT CREATE SYNONYM, CREATE DATABASE LINK, RESOURCE , UNLIMITED TABLESPACE TO hr
*
ERROR at line 1:
ORA-01917: user or role 'HR' does not exist
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
Warning: You are no longer connected to ORACLE.
SP2-0640: Not connected
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
SP2-0640: Not connected
SP2-0640: Not connected
SP2-0310: unable to open file "E:\github.com\oracle\db-sample-schemas\human_resources\human_resources\hr_cre.sql"
SP2-0310: unable to open file "E:\github.com\oracle\db-sample-schemas\human_resources\human_resources\hr_popul.sql"
SP2-0310: unable to open file "E:\github.com\oracle\db-sample-schemas\human_resources\human_resources\\hr_idx.sql"
SP2-0310: unable to open file "E:\github.com\oracle\db-sample-schemas\human_resources\human_resources\\hr_code.sql"
SP2-0310: unable to open file "E:\github.com\oracle\db-sample-schemas\human_resources\human_resources\\hr_comnt.sql"
SP2-0310: unable to open file "E:\github.com\oracle\db-sample-schemas\human_resources\human_resources\\hr_analz.sql"
not spooling currently
SQL>
How to fix these error:
SP2-0606: Cannot create SPOOL file
ORA-01918: user 'HR' does not exist
ORA-65096: invalid common user or role name
The easy ones first:
ORA-01918: user 'HR' does not exist
The script starts with a precautionary drop user statement. You haven't run the script before so there is no HR user to drop. Hence the message. You can ignore it.
ORA-65096: invalid common user or role name
You have given an invalid password: Enter value for 1: 123456. For whatever reasons Oracle passwords follow similar rules to object names, which means the password must start with a letter - unless it's wrapped in double-quotes.
Now this is a trickier issue:
SP2-0606: Cannot create SPOOL file
So, does directory C:\vy exist? Does your user have write access to it?
I had same issue.
You need create HR user before runnig "hr_main.sql". Follow next steps::
SQL> connect sys as sysdba
Enter password:
Connected.
SQL> create user HR identified by oracle;
User created.
SQL> #?/demo/schema/human_resources/hr_main.sql
and next step as in guide:
https://docs.oracle.com/database/121/COMSC/installation.htm#COMSC109

Oracle 11g XE initialization on ubuntu 12.04

I was following this tutorial:
http://sysadminnotebook.blogspot.com/2012/10/installing-oracle-11g-r2-express.html
and I sucessfully installed and started oracle database. Now I wanted to connect to that DB from bash, so I found that command:
sqlplus sys as sysdba
It asks for password, which in my case is oracle, and after I supply it, I get:
ORA-01031: insufficient privileges
What should I do?
EDIT:
I needed to add group dba and add myself to that group. However I've got other problem now. I wanted to create user, so I did:
CREATE USER myuser IDENTIFIED BY password
default tablespace users
temporary tablespace temp;
And I got: ORA-01034: ORACLE not available.
I tried: STARTUP But I got:
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/xe/dbs/initXE.ora'
I have '/u01/app/oracle/product/11.2.0/xe/dbs/init.ora' file but not initXE.ora
Is the o/s user a member of the dba group?
If this is a new installed Oracle and you do not have initXE.ora parameter file here /u01/app/oracle/product/11.2.0/xe/dbs/, that means you need to create XE DB first. To do that run /u01/app/oracle/product/11.2.0/xe/bin/createdb.sh script first.

CruiseControl.rb throwing exception with Postgres

In a VPS I have Postgres installed and 2 Rails projects. Both are running on production mode and connecting PG as different users.
Now I want to set CruiseControl.rb for one of them. Everything went perfectly, except when cruise is trying to run the test it's throwing this error:
PGError: ERROR: permission denied to create database
: CREATE DATABASE "myProject" ENCODING = 'utf8'
This test database is created with a different owner name, and all of them are specified correctly in ~/.cruise/projects/myProject/work/config/database.yml.
When I am running these following series of commands manually inside ~/.cruise/projects/myProject/work, they are working perfectly.
RAILS_ENV=test rake db:migrate
rake test
I've created the database using these following commands:
create user test_user with password 'abcxyz';
create database test_database TEMPLATE template0 owner test_user;
grant all privileges on database test_database to test_user;
After hitting the Build Now button, the test_database is getting deleted, and then its trying to create it again and throwing that exception.
I'm puzzled, why the test db is getting deleted on the first place? Is there anything I'm missing here?
It sounds like you haven't granted access to your test user to create a new database, even though you issued permissions for the test_user on the existing test_database.
You may need to grant privileges to create a new DB like so:
GRANT CREATE ON SCHEMA public TO test_user;
The commands you executed before created the test_user and so must have been executed as an admin or the postgres user.
TL;DR
You should compare the permissions for your cruise user to the user you executed these steps with manually, something is wrong preventing the test db creation during db:test:prepare

Resources