Import file into MariaDB on Windows WSL - mariadb

I'm trying to import a file into MariaDB on my WSL Subsystem on Windows, following this thread: https://stackoverflow.com/questions/17666249/how-to-import-an-sql-file-using-the-command-line-in-mysql
I have copied the .sql file to my home directory in WSL and hence my command looks like this:
$ mysql -u root -p sampledatabase < ~/databases/Datanmodell_init.sql
But I keep getting the following error:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using
password: YES)
What am I doing wrong?
merci A

Related

'Access denied for user 'user'#'localhost'

I am trying to create a sql user which has the sole role of performing the login procedure but I keep getting the same error: Access denied for user 'login'#'localhost' (using password: YES)
I created the user like this:
CREATE USER IF NOT EXISTS 'user'#'%' IDENTIFIED BY 'password';
GRANT EXECUTE ON procedure `table`.`login` TO 'user'#'%';
If I try to login via terminal or mysql workbench or use the mysql_real_connect() function in my C client, i always get the same error.
I solved it by reinstalling mariadb and using the following commands:
mysql_upgrade -u root -p
chown mysql:mysql /var/lib/mysql -R
systemctl enable mysqld
systemctl start mysqld
My system is arch linux, this can also be useful to better manage the installation of mysql or mariadb: https://wiki.archlinux.org/index.php/MySQL

odbcinst: SQLGetPrivateProfileString failed with Unable to find component name

I am able to use unixodbc without any problem with my default user. But when I switch to another user, I get an error.
[centos# ~]$ odbcinst -q -s
[ODBC]
[Amazon Redshift DSN 32]
[centos# ~]$ su ruser
Password:
[ruser# centos]$ odbcinst -q -s
odbcinst: SQLGetPrivateProfileString failed with Unable to find component name.
Environment variables are set in both of the users:
AMAZONREDSHIFTODBCINI=/etc/amazon.redshiftodbc.ini
ODBCSYSINI=/usr/local/odbc
ODBCINI=/etc/odbc.ini
LD_LIBRARY_PATH=/usr/local/lib
LD_PRELOAD=/usr/local/lib/libodbcinst.so
Odbc configuration is as follows:
[ruser# centos]$ odbcinst -j
unixODBC 2.3.4
DRIVERS............: /usr/local/odbc /odbcinst.ini
SYSTEM DATA SOURCES: /usr/local/odbc /odbc.ini
FILE DATA SOURCES..: /usr/local/odbc /ODBCDataSources
USER DATA SOURCES..: /etc/odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
By the way, I don't understand why there are spaces in the above paths. I don't know if there is a way to change them. Any ideas to solve this issue? Overall odbc configuration seems the same in both of the users.
I found the exact same issue on Centos, where I could use the default centos user to connect, but not any other users.
I was able to resolve the issue by copying the working user (or system) odbc.ini and odbcinst.ini files across into the home directory of the other user, like so (where I have renamed them to .odbc.ini and .odbcinst.ini respectively):
~/.odbc.ini
[MSSQLTest]
Driver = ODBC Driver 17 for SQL Server
Server = tcp:<ip of server>
~/.odbcinst.ini
[ODBC Driver 17 for SQL Server]
Description=Microsoft ODBC Driver 17 for SQL Server
Driver=/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.2.so.0.1
UsageCount=1
Finally, I just had to set the following environment variables inside my ~/.bashrc file, and I was able to connect.
export ODBCSYSINI="<full path to user folder, which would be the evaluated path of {echo ~}>"
export ODBCINSTINI=".odbcinst.ini"
export ODBCINI="<full path to user folder, which would be the evaluated path of {echo ~}>/.odbc.ini"
For some reason, I wasn't able to use ~ to reference the user folders, so I had to manually specify the full user path in the environment variables, and thus my complete .bashrc file is simply:
export ODBCSYSINI="/home/mitch"
export ODBCINSTINI=".odbcinst.ini"
export ODBCINI="/home/mitch/.odbc.ini"
With this setup, I could now run the following and connect successfully:
$ isql -v MSSQLTest <sql server username> <sql server password>
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>

Maria DB Access Privileges

I have created my Maria DB Instance under Centos 7 using the the following command
[username#localhost]$ sudo yum install mariadb-server
System Enabled and Started with the following Commands
sudo systemctl enable mariadb
sudo systemctl start mariadb
I have secured the installation with the following command
sudo mysql_secure_installation
The Server was secured and invoked the mysql prompt using
mysql -u root -p
There is no problem. I am able to use this command to get into SQL Command
However when I am trying to load tables, i am getting the following error
ERROR 1045 [28000]: Access Denied for user 'root#'localhost' (using
password: NO)
Unable to load data. What could be the solution
Thanks
Sreeram

Rstudio server on Ubuntu 16.04.2 LTS, RStudio initialization error: unable to connect to service

I have successfully installed Rstudio server (open source) on VM located on Ubuntu 16.04.2 LTS in the institute cluster. I can access the URL on port 8787. But when I try to sign in to Rstudio using my username and password, it processes for few seconds and then shows the following:
RStudio initialization error: unable to connect to service
I did not get any error when I ran command sudo rstudio-server verify-installation. But when I checked /var/log/syslog which shows the following:
ERROR system error 13 (Permission denied) [path=/home/biology/.rstudio, target-dir=]; OCCURRED AT: rstudio::core::Error rstudio::core::FilePath::createDirectory(const string&) const /home/ubuntu/rstudio/src/cpp/core/FilePath.cpp:826; LOGGED FROM: int main(int, char* const*) /home/ubuntu/rstudio/src/cpp/session/SessionMain.cpp:3303
PS: R version 3.3.2 (2016-10-31); rstudio-server-1.0.136-amd64.deb
Suggestions please.
Thanks!
I got the solution for this. I was already having the root access and I proceeded as follows:
1) mkdir /home/biology/.rstudio
2) mkdir /home/biology/.rstudio/graphics-r3
3) sudo chown -R biology:my_group .rstudio
and it worked :)
I had the same issue as #gbioinfo (R version 3.4.2; rstudio-server-1.1.383-amd64.deb; ubuntu 16.04) and had to run the first two commands as sudo.
This is most likely Permission for the home directory of the system user that you are trying to use to login to rstudio.
lets assume that the username is "rstudio_user". simply make sure that you have a home directory created for this user and this user has full permissions or ownership permission to access the directory.
At least for my experience, when I created the username, the username didn't have a home directory. so simply follow the below
sudo mkdir /home/rstudio_user
sudo chown -R rstudio_user rstudio_user

MariaDB + phpmyadmin with Ngnix on ubuntu 14.04

I am trying to install phpmyadmin + mariadb.
My PHP configure string has the following mysql flags
CONFIGURE_STRING="--prefix=/etc/php7 --enable-mysqlnd --with-mysqli=mysqlnd
--with-pdo-mysql=mysqlnd <and other flags>"
I installed mariadb with the following:
sudo apt-get install mariadb-client mariadb-server
sudo mysql_secure_installation
I can login with a password via
sudo mysql -u root -p
Then I installed phpmyadmin with
cd /var/www/html
git clone --depth=1 --branch=STABLE https://github.com/phpmyadmin/phpmyadmin.git
mv phpmyadmin datastore #change name to datastore
When I open http://localhost/datastore I received the phpmyadmin login page; in attempt to login with root username and root password, i received the following error:
#2002 - No such file or directory — The server is not responding (or the local server's socket is not correctly configured).
AND
mysqli_real_connect(): (HY000/2002): No such file or directory.
I am using php7 on ubuntu 14.04.
I wish to be able to connect mariadb and phpmyadmin.
Got some directions from Git on how to solve the problem and these are my steps, I feel someone may encounter the same challenge.
In phpmyadmin copy config.sample.inc.php into config.inc.php
sudo cp config.sample.inc.php config.inc.php
Check MariaDB status with STATUS;
MariaDB [(none)]>STATUS; [ENTER]
Check Connection - if localhost via Unix Socket then copy unix socket value.
Go to config.inc.php and force the following
$cfg['Servers'][$i]['connect_type'] = 'socket';
$cfg['Servers'][$i]['socket'] = '/var/run/mysqld/mysqld.sock';
Then change permission of config.inc.php in phpmyadmin
sudo chmod 0755 config.inc.php
Point your browser to phpmyadmin and login with your username and password.
Git link

Resources