The issue is when you need to echo something as root/sudo, that it doesn't work. You can never do a sudo echo to an output file as you'd expect.
Take an example to clear out wasted RAM buffers/cache like this:
sudo echo 1 > /proc/sys/vm/drop_caches
-bash: /proc/sys/vm/drop_caches: Permission denied
The solution is to run tee as sudo/root
What we do is echo 1, but then pipe it to the "tee" command as sudo........
The Best Docker Tutorial for Beginners
We quickly explain the basic Docker concepts and show you how to do the most common tasks from starting your first container, to making custom images, a Docker Swarm Cluster Tutorial, docker compose and Docker buildfiles.........
If you get an error that you aren't in the sudoers file, this typically means that your user is not designated as an admin with sudo privileges.
In plain English, when it comes to some OS's like Debian including 10,11 etc.., by default the user is created without special privileges which is contrary to how Ubuntu/Mint handle the secondary user.
Let's check the sudoers file to see the problem.........
This is caused because the user is running as qemu for virt-resize and if qemu does not have privileges to read from the source and write to the destination, it will fail with the below. So either change the uid of qemu or change the ownership of the source and target.
virt-resize --expand /dev/sda2 /root/kvmtemplates/windows2019-eval-template.img /root/kvmguests/kvmkvmuser4515........
yum -y install wget unzip
yum -y install php php-mysqlnd php-json php-zip php-dom php-xml php-libxml php-mbstring php-gd mysql mysql-server
Last metadata expiration check: 0:58:02 ago on Fri 13 Mar 2020 02:12:49 PM EDT.
MySQL on Debian versions is configured differently than the native local MySQL plugin so you will be disappointed when your password on the mysql client fails by default.
Here is how you reset the MySQL root password the proper and "working way"
#first we gracefully stop mysql
sudo systemctl stop mysql;
#then we forcefully kill any mysqld process just in case
sudo killall -9 mysqld mysqld_safe;........
mysql reset root password.
Oops I can't remember my MySQL root password!
[root@centos7test etc]# mysql -u root -p
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
First we need to stop mariadb:
systemctl stop mariadb
Now we need to restart it with skip-grant-tables whic........
yum -y install mariadb-server
systemctl start mariadb
Now we need to secure our install and set the MariaDB root password:
The lines you need to act on are marked in bold shown with the answer you need.
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
create database yourdbname;
Show All Databases:
Drop / Delete a MySQL Database:
drop database nameofyourdatabase;........
This is most likely to happen on a normal GUI system like Ubuntu or Linux Mint. If you or the user is meant to have sudo / root privileges it is as simple as editing the following files:
Now assume your username is "iamtheuser"
Find the above lines and add a comma and "ia........
GRANT SELECT, LOCK TABLES ON *.* TO yourmysqluser@localhost;
All you need to do a full MySQL dump on all databases is the SELECT and LOCK TABLES privileges. This way you don't have to use the mysql root user. Data could be compromised this way but at least no harm from manipulation, changes or deletion are possible by locking down the privileges to the minimum for a full MySQL dump and backup.........
The commands below will help you reset any mysql user password.
update user set password=PASSWORD('thenewpass') where User='theusername';
The first line says to use the "mysql" database which contains all the user info.
the second update line sets the new password "thenewpass" for the u........
This is a common issue, what if a issue shouldn't have root but you want to use that user to make a full backup of a system? They of course need root access.
You can actually just give them passwordless sudo access to rsync in /etc/sudoers:
sudo vi /etc/sudoers
yourusername ALL = NOPASSWD: /usr/bin/rsync
Here is how you would execute rsync:
The key thing for the remote host is to........
The solution is simple but strange, if you copy your /var/lib/mysql directory to another server and think it will work, be sure to check if you have /var/log/mysql and binary log files. If you do, the server will not work and will give you errors like below and crash without the proper log files.
UPDATE user SET password=password("newpass") WHERE user='root';
ERROR 2013 (HY000): Lost connection to MySQL server durin........
mysqldump: Couldn't execute 'show create table `general_log`': SHOW command denied to user 'user'@'localhost' for table 'general_log' (1142)
One of my clients almost found out the hard way, here is an unlikely situation that happened.
1.) Years ago the client had another VPS to which they backed up a BLOG nightly to an .sql file, what they forgot is that the file also contained all databases (they used the --all-databases option but forgot). So imagi........
ERROR 1146 (42S02): Table ‘mysql.servers’ doesn’t exist
This happened to me on a system running Centos with the REMI repo and a new version of Mysql 5 (which the official Centos/RHEL does not support on version 5).
The solution is just to run this program "mysql_upgrade", after that flush privileges will work.
One note is to secure MySQL, I don't know for sure but I believe you could login to MySQL remotely with no password during this operation (I'm not sure, maybe it doesn't accept blank passwords but I firewall MySQL port anyway and recommend you do the same).
First edit /etc/my.cf
Under the [mysqld] field add the following line somewhere:
Now restart mysql: service mysql restart or on Debian sty........
CREATE Database/Granting PrivilegesCREATE your first database
[code:1:0668cd8e74]CREATE database myfirstdb;
CREATE a user for your first database
This one creates the user 'sqladmin' and gives them 'usage' on your new database 'myfirstdb'
[code:1:0668cd8e74]mysql> GRANT usage on myfirstdb.* to sqladmin@localhost;
Query OK, 0 rows affected (0.00 sec)[/code:1:0668........
I have played around with Pound a little bit. It is a reverse proxy and load balancer in one, and it can be used as only a reverse proxy if you like. It is very simple to configure as either, and Pound even senses if one of the systems is down and stops sending requests to the dead server.
It supports SSL (but passes the request to the destination server unencrypted) and even the Apache log format. Pound is very simple, fast a........
This happened with a select statement which writes the result to an external file. I didn't remember the privilege "FILE" must be granted on *.* for this to work successfully, it wasn't actually an authentication issue as it implies since I was already in the SQL prompt and doing the query.
INTO OUTFILE '/tmp/result.txt'........
There is a nice mode that Samba supports which you can add to smb.conf
This way users can create and write files/directories without deleting (except I believe dirs can be deleted but only if there are no files inside).
It's too bad that Linux does not have built-in "write"/"delete" privileges and is something that even Windows 98 can trump.........
Backing MySQL Databases
Backing Up/Dumping All Mysql Databases To A Single File
mysqldump --all-databases -u admin -p > allmysqldatabases.sql
The "-all-databases" clause is pretty obvious isn't it? It means that it will backup all databases.
The "-u admin" means login using the user "admin", if you h........