Pages

Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Sunday, July 11, 2021

UBuntu Database Error: Access denied for user 'root@localhost' (using password:NO)

 
https://stackoverflow.com/questions/2995054/access-denied-for-user-rootlocalhost-using-passwordno

[root ~]# mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password:NO)

sudo mkdir /var/run/mysqld
sudo chown mysql: /var/run/mysqld

sudo mysqld_safe --skip-grant-tables --skip-networking &



1. Stop the service/daemon of mysql running

    [root ~]# service mysql stop   
    mysql stop/waiting

2. Start mysql without any privileges using the following option; This option is used to boot up and do not use the privilege system of MySQL.
    [root ~]# mysqld_safe --skip-grant-tables &

3. enter the mysql command prompt
    [root ~]# mysql -u root
    mysql>

4. Fix the permission setting of the root user ;
    mysql> use mysql;
    Database changed
    mysql> select * from  user;
    Empty set (0.00 sec)
    mysql> truncate table user;
    Query OK, 0 rows affected (0.00 sec)
    mysql> flush privileges;
    Query OK, 0 rows affected (0.01 sec)
    mysql> grant all privileges on *.* to root@localhost identified by 'YourNewPassword' with grant option;
    Query OK, 0 rows affected (0.01 sec)

*if you don`t want any password or rather an empty password
    
    mysql> grant all privileges on *.* to root@localhost identified by '' with grant option;
    Query OK, 0 rows affected (0.01 sec)*
    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)

Confirm the results:
    mysql> select host, user from user;
    +-----------+------+
    | host      | user |
    +-----------+------+
    | localhost | root |
    +-----------+------+
    1 row in set (0.00 sec)

5. Exit the shell and restart mysql in normal mode.
    mysql> quit;
    [root ~]# kill -KILL [PID of mysqld_safe]
    [root ~]# kill -KILL [PID of mysqld]
    [root ~]# service mysql start

6. Now you can successfully login as root user with the password you set
    [root ~]# mysql -u root -pYourNewPassword
     mysql>

Monday, May 17, 2021

Share Windows Network Shared Files in Ubuntu(20.04)

===================================================

/*
 *
 * Share files from Windows Operating System TO Ubuntu
 *
 */

===================================================


sudo apt update
sudo apt-get install cifs-utils
sudo mkdir /mnt/winshare

sudo chown -R nobody:nogroup /mnt/winshare
sudo chmod -R 0755 /mnt/winshare

user: windowsusername
pass: userpassword

sudo mount -t cifs -o username=windows_user_account_here //WIN_MACHINE_IP/PublicShares /mnt/winshare

sudo mount -t cifs -o username=am-dev //192.168.00.001/directoryname1 /mnt/winshare/directoryname1
sudo mount -t cifs -o username=am-dev //192.168.00.001/directoryname2 /mnt/winshare/directoryname2

alias winsharedev="sudo mount -t cifs -o username=am-dev //192.168.0.222/ampdevelopment /mnt/winshare/ampdevelopment"
alias winsharevue="sudo mount -t cifs -o username=am-dev //192.168.0.222/vueapp /mnt/winshare/vueapp"

unalias winsharedev
unalias winsharevue


AUTO CONNECT

set Credentials on  a file
sudo nano /etc/win_cred

Windows Network user Credentials

username=windowsusername
password=userpassword
domain=192.168.00.001

Assign user and permissions to file

sudo chown root: /etc/win_cred
sudo chmod 600 /etc/win_cred

mount Network directory  to ubuntu directory /mnt/winshare

sudo mount -t cifs -o credentials=/etc/win_cred WIN_MACHINE_IP/PublicShares /mnt/winshare//

sudo mount -t cifs -o credentials=/etc/win_cred 192.168.00.001/directoryname /mnt/winshare/directoryname/

Saturday, February 20, 2021

WILD CARD SSL for Sub Domains. in apache Server Ubuntu using Certbot

 

##### ===================================================
WILD CARD SSL for Sub Domains.

##### ===================================================

=> sudo certbot certonly --manual -d *.example.com -d example.com --agree-tos --no-bootstrap --manual-public-ip-logging-ok --preferred-challenges dns-01 --server https:acme-v02.api.letsencrypt.org/directory//

This records should be added as TXT records in DNS

_acme-challenge.ampbk.com with the following value:

vMuf4mcFeV7aP36a9idiuskjhSeh992Q7SL6R-8N4wFSs

Before continuing, verify the record is deployed.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Press Enter to Continue

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please deploy a DNS TXT record under the name
_acme-challenge.ampbk.com with the following value:

00HYjN4kOskrT2atQgaKz-4856QQkmrrZvZwHNeQz

/etc/letsencrypt/live/example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/exmple.com/privkey.pem


create s.example.com.conf
and update ssl to these SSL files

Deactivate the site and activate the
sudo a2dissite example.com
sudo service apache2 restart

sudo a2ensite example.com
sudo a2ensite s.example.com

then restart the apache2 service.

sudo service apache2 restart.